Intro -
The C is a general-purpose, high-level
language developed in 1972 by Dennis M.
Ritchie at
AT & T’s Bell Labs to develop the UNIX
operating system.
Example
Just open the Turbo C++ and write the
following code…
#include <stdio.h>
#include <conio.h>
int main( )
{
/* My first program in C language. */
clrscr );
printf("Hello, World! \n");
getch( );
return 0;
}
Now press ALT+F9 to compile and
CTRL+F9 to run it.
Its structure
A C program basically consists of the following
parts:
Preprocessor Commands
Functions
Variables
Statements & Expressions
Comments
Here…
# : is a preprocessor
directive.
include : is a preprocessor
command.
stdio.h : is a header file.
conio.h : is a header file.
Facts:
a) The stdio.h stands for Standard Input
Output and it contains the declaration of
printf( ) and scanf( ) functions.
b) The conio.h stands for Console Input
Output and it contains the declaration of
clrscr( ) and getch( ) functions.
main()
{
…
}
A program must contain at least a single
function that is main() because the execution
of any program start from main().
Facts:
a) The main() function is always called by an
Operating System.
/* My first program in C language. */
This is a comment and we can use it to write
something that will be ignored by C compiler.
clrscr();
This is a function and we can use it to
clear the last output on the screen.
printf();
This is a function and we can use it to
insert any text string on the screen.
scanf();
This is a function and we can use it to
accept anything from the keyboard.
getch();
This is a function and we can use it to
accept a character input from the keyboard.