fb popup

/* remove if it's exist in your template */

Detailed C Structure

Structure:-

#include<stdio.h>

#include<math.h>

void main()

{     //beginning of the program

printf("welcome");   //prints welcome

/* for this program there is no need of giving math.h as we are not using any mathematical part which are already pre-defined as library functions of math.h  */

//end of program

}
output is :- welcome 

The compiler will not compile the comments at all.

Detailed C Structure
 output:-
Detailed C Structure output

 OK guys here we got one warning.It is showing that we did not give a return type to void as int.

 I have already explained you about return type in my first page-C structure. Actually we can give return type as void for main().

But some compilers would ask us to give int as return type for main. We can ignore those warnings or if you don't want such warnings we can also write the program as:-
#include<stdio.h>

#include<math.h>

int main()

{     //beginning of the program

printf("welcome");   //prints welcome

/* for this program there is no need of giving math.h as we are not using any mathematical part which are already pre-defined as library functions of math.h  */

return(0);

//end of program

}
both void and giving int as return type and sending '0' to main, both are same.

 Ex:-

Detailed Structure of C

 here we got no warnings. output:-

Detailed Structure of C output


 Even though we change void to int as return type the output will be same.

No comments:

Post a Comment