Introduction to C
C programming is a general-purpose,
procedural programming language.
Developed in 1972.
Developed by Dennis M. Ritchie at bell
laboratories of AT&T (American Telephone &
Telegraph), located in the U.S.A.
C is used to develop the UNIX operating
system.
C can be defined by the following ways:
1) Mother language
2) System programming language
3) Procedure-oriented programming language
4) Structured programming language
5) Mid-level programming language
Why to Learn C Programming?
1) Easy to learn
2) Structured language
3) It produces efficient programs
4) It can handle low-level activities
5) It can be compiled on a variety of computer
platforms
Facts about C
C was invented to write an operating system
called UNIX.
C is a successor of B language which was
introduced around the early 1970s.
The language was formalized in 1988 by the
American National Standard Institute (ANSI).
The UNIX OS was totally written in C.
Applications of C Programming
Operating Systems
Language Compilers
Assemblers
Text Editors
Network Drivers
Modern Programs
Databases
Language Interpreters
Utilities
1) Machine Independent or Portable
Unlike assembly language, c programs can
be executed on different machines with
some machine specific changes.
Therefore, C is a machine independent
language.
2) Mid-level programming language
Although, C is intended to do low-level
programming. It is used to develop system
applications such as kernel, driver, etc.
It also supports the features of a high-
level language. That is why it is known as
mid-level language.
3) Structured programming language
C is a structured programming language in
the sense that we can break the program
into parts using functions.
So, it is easy to understand and modify.
Functions also provide code reusability.
First C Program
#include <stdio.h>
int main()
{
printf("Hello C Language");
return 0;
}
#include <stdio.h> includes the standard
input output library functions. The printf()
function is defined in stdio.h .
int main() The main() function is the
entry point of every program in c
language.
printf() The printf() function is used to
print data on the console.
return 0 The return 0 statement, returns
execution status to the OS. The 0 value is
used for successful execution and 1 for
unsuccessful execution.
Compilation process in c
The compilation is a process of converting the
source code into object code.
It is done with the help of the compiler.
The compiler checks the source code for the
syntactical or structural errors, and if the
source code is error-free, then it generates
the object code.
Compilation process in c
The following are the phases through which
our program passes before being transformed
into an executable form:
A. Preprocessor
B. Compiler
C. Assembler
D. Linker