C Programming

C – Structure Explanation of C Program

C programming is an High Level Programming Language. It is developed by Dennis Ritchie between 1969 and 1973 at AT & T Bell Labs. 

Example:  Definition before start programming we have to know basic things.  /* for comment about program */ header files are required, these are standard input/output library files. examples,

  • #include<stdio.h> 
  • #include<conio.h> 
  • #include<math.h> 
  • #include<ctype.h>
  • #include<string.h> etc.

the header files are always start with # character set and enclosed with less then  greater than sign 

void main() or main(): 

The main function is used for execute the program from beginning, this is means every program contain main function, the main function always enclosed with braces ().

Example: 

/* A program to print hello world*/
--- Comment about program. 
#include<stdio.h>/*Header files- or preprocessor*/
int main(void)/* main finction*/ 
{/* statement start with curly braces*/   
printf("Hello,world"); /* it is end with semicolon signs ;*/   
return 0;} 

/* statement closed with curly braces*/

 

Explanation of this program.

/* this program…*/

The symbols /* and */ are comment. Comments are ignored by the compiler, and it is used to provide useful information for humans that will read the program.

void main ()

C program consist of one or more functions. Void main is known as a function not a variable.  () used to denote the function.

{…..}

Braces are the body of the function, which consist of one or more instructions (statement).

Printf();

Is a library function that is used to print on the standard input/output.

“Hello Worldn”

It is a string constant.

n

Is the newline character or these are called escape sequence characters.

;

A semicolon terminates a statement.

Return 0;

Return the value zero to the operating system. Note: C is case sensitive, so the names of the functions (main and printf) must be typed in lower case as above.

Related Articles

Back to top button

Adblock Detected

Please turn off your Adblocker to view your content.