C was developed at AT & T Bell Laboratories by Dennis Ritchie. It is evolved from the programming language called B created by Ken Thompson at the same Bell Laboratory. Later the C was standardised by ANSI committee and hence it became to be known as ANSI C.
Here, look at the following C program :
#include<stdio.h> void main() { printf("Welcome to C. \n This is your first program"); }
In the first line #include<stdio.h> states that a file "stdio.h" is to be included in the program i.e the first line will be replaced by the contents of "stdio.h". The files with extension '.h' are called header files and they contain some predefined functions. Here the printf() is defined in "stdio.h" header file.
void main() : main() is a function that marks the beginning of execution of a program. Here, it has the return type void because i do not need to return any value.
In the line 3 { marks the beginning of the main() function.
printf() is a function that is used to print any values to the screen. Any matter within the " " (double quotes) is treated as a string and is displayed to the screen. The '\n' tells that the following characters are to be displayed in a new line. (See escape sequences to get more like \n)
In the line 5 } marks the end of the main() function.
Output:
Welcome to C.
This is your first program
just a doubt,,, whats that span thing??
ReplyDeletedidn't notice that.... that was a html glitch... removing it.....
Delete