Experiment No: 01
Name of the Experiment
Study of the fundamentals of C programming.
Objectives
The key objectives of this experiment are:
• Understand the way software works and functions.
• Learning the fundamental syntax of C programming.
• Learning programming concepts. Many other programming languages are influenced
by C, so mastering its fundamentals provides a solid foundation for learning other
languages such as C++, Java, and C#.
Introduction
In the realm of computer science, few languages command the enduring relevance and
universal acclaim of C. Originating in the laboratories of Bell Labs, C programming has
transcended decades, serving as the cornerstone of modern software engineering. This report
offers a concise exploration of the fundamentals of C programming, illuminating its syntax,
principles, and practical applications. From its humble beginnings to its pervasive influence in
system programming and beyond, C programming stands as a testament to the elegance and
power of computational abstraction. Join us as we embark on a journey through the essence of
C, uncovering its timeless wisdom and unlocking new vistas of programming prowess.
Software: Software refers to a collection of instructions, programs, and data that enable a
computer system to perform specific tasks or functions. It encompasses both the tangible
components of computer programs, such as code written in programming languages, as well as
the intangible aspects, such as algorithms and data structures.
Programming Languages: Programming languages facilitate communication between
humans and computers, allowing programmers to express computational tasks in a manner that
computers can interpret and execute. Programming languages vary in complexity, paradigm
(such as procedural, object-oriented, or functional), and application domain. Examples include
high-level languages like Python, Java, and C++, which offer abstraction and ease of use, as
well as low-level languages like assembly language, which provide direct control over
hardware resources. C is a versatile language that combines procedural and structured
programming paradigms, making it well-suited for a wide range of applications, from operating
systems and device drivers to application software and game development.
Compiler: A compiler is a software tool that translates high-level programming code written
in a programming language into machine-readable code, typically in the form of object code
or executable files. The process of compilation involves several stages, including lexical
analysis, parsing, optimization, and code generation. One of the most commonly used C
compilers is GCC (GNU Compiler Collection). It is a free and open-source compiler suite
developed by the GNU Project and supports various programming languages, including C,
C++, and Fortran.
1|Page
IDE: IDE stands for Integrated Development Environment. It's a software application that
provides comprehensive facilities to programmers for software development. An IDE typically
includes a source code editor, build automation tools, debugging functionality, and other
features that streamline the process of writing, testing, and debugging code. Examples of
popular IDEs include Visual Studio, Eclipse, Code::Blocks and PyCharm.
Program
Figure 1: “Hello World” code on Code::Blocks
Explanation
Line 1: This line includes the standard input-output library (stdio.h) in your program. It
provides functions like printf() and scanf() for input and output operations.
Line 3: This declares the main function, which is the entry point of a C program. The int before
main specifies that the function returns an integer value to the operating system upon
completion.
Line 4: Curly brace marks the beginning of the main function's block. In C, blocks of code are
enclosed within curly braces.
Line 5 – 7: This lines uses the printf() function to print the string "Hello World!" followed by
a newline character (\n) to the standard output. The other strings are printed as well.
Line 8: This line returns an integer value of 0 from the main function, indicating successful
program execution to the operating system. It's a convention in C programs to return 0 from
the main function to signify successful termination.
2|Page
Output
Figure 2: Output of the shown program
Discussion and Conclusion
In summary, this C code exemplifies the fundamental concepts of programming. From the
ubiquitous "Hello World!" message to personalized expressions, it showcases the power of the
printf() function for output. Beyond its simplicity, the code instills key principles of syntax and
structure essential for effective coding. As a starting point for aspiring programmers, it ignites
curiosity and lays the groundwork for further exploration in the dynamic field of computer
science.
Reference
1. “Teach Yourself C” by Herbert Schildt
2. https://www.techtarget.com/searchwindowsserver/definition/C
3|Page