Sample program:
#include<stdio.h> ///way to comment header file required
int main() ///main function
{
printf("Hello world"); //// print message on screen
return 0;
}
Explanation:
First line is necessary , it is header file to be included for functions like printf.
Second line is main function .Every C program starts from here .So fixed line in a program.
line 3: { this denotes a block will start from here. Just your task what you need to do will start and } denotes end of the block.
line 4: this will display Hello World on your screen.
return 0 : compulsory line , we will discuss it later.
line 6: } ends the program.
No comments:
Post a Comment