Welcome back to series of articles on Introduction to C Programming. In this article you are going to learn the very basic structure of a C Program.
Basic Structure of C Program:-
Preprocessor Statements
Global Declarations
int main()
{
Local Declarations
Statement(1);
Statement(2);
------------------
------------------
Statement(n);
return int_value;
}
User Defined Functions
Example:-
#include "stdio.h" //Preprocessor statement
#define PI 3.1416
const float radius=10.5; //Global declaration
int main()
{
float circumfernce; //Local declaration
circumfernce=findCicrum(); //User defined function call
printf("Circumference of the circle is %f",circumfernce); //printing the output
return 0;
}
float findCircum() //User defined function
{
return 2*PI*radius;
}
No comments:
Post a Comment