(Read all the paragraph, if you want better knowledge in C.)Let us begin with a quick introduction in C.
First to start Programming in c.
In C, the program to print ``hello, world'' is
#include <stdio.h>
main()
{
printf("hello, world\n");
getch(); /* It is important to write this function. otherwise you will not be able to see your program. It means Get Character.*/
}
To perform this programme you need a software to write program in and to compile.
Here is the link to that software. Visit.
The first line of the program,
#include <stdio.h> tells the compiler to include information about the standard input/output library; the line appears at the beginning of many C source files. Main is defined to be a function that expects no arguments, which is indicated by the empty list ( ).
#include <stdio.h> include information about standard library
main() define a function called main that received no argument values { statements of main are enclosed in braces.
printf("hello, world\n"); main calls library function printf to print this sequence of characters } \n represents the newline character The first C program
The statements of a function are enclosed in braces { }. The function main contains only one statement,
#include <stdio.h>
main() { printf("hello, "); printf("world"); printf("\n"); } to produce identical output. Notice that \n represents only a single character. An escape sequence like \n provides a general and extensible mechanism for representing hard-to-type or invisible characters. Among the others that C provides are \t for tab, \b for backspace, \" for the double quote and \\ for the backslash itself.
No comments:
Post a Comment