Basic Structure of C- Program

The file name of c program must be with .c extension.

Note: Turbo c compiler (windows platform) follows ANSI C standard.

And GCC (LINUX platform) follows a C99 standard.

  • Definition of program present in libraries.
  • Function call present in our program.

A simple structure of C- program :

#include<header_file>

function_declaration;

global_varables;

main( )

{

             local variables;

             program logic;

}

 

Example:

#include<stdio.h>               //header file

#include<conio.h>

main()                                  //main function

{

int a;                        //local variable

printf(“enter a number :”);            //program logic

scanf(“%d \n”, a);

printf(” you’ve entered : %d “,a);

}

 

 

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: