Add

Friday, November 16, 2018

Structure of C program and Why we put braces () with main


Structure of C program
A C program consist of following parts.
1- preprocessor Directive (#include<iostream.h>)
2-main function                                                 void main ()
{   
  program body
}




Why we put braces () with main

Braces tells the compiler that the word “main” is name for a function. Otherwise compiler will consider it is name of some variable or identifier.
If braces are empty it means function do not take input from some other function
Like void main()
If braces are not empty then it means function may take input arguments.
Like void main(int a , char b ) means this funciton can take two input arguments.


No comments:

Post a Comment