Lets start
structure of 'C' program looks like this
# include
void main()
{
some code
}
this is the structure of a 'C' program.lets learn about each of these statements
#include
Every 'C' program starts with this statement.we call this statement as preprocessor directive
in this statement # include is a preprocessor directive which is a directive given to a compiler or processor.
Altogether # include
next statement is void main()
this is a point at which our 'C' program execution starts,we call this a main function which will begin our 'C' program execution.We will discuss about void keyword in later session.
{ ---------->starting of a program
some code
} ---------->end of the program
{ } we call it as block binders which are used to hold the block of statements which indicate start and end of program or block.
Lets begin with our first program
# include
void main()
{
printf("welcome to c world");
}
note:remember that all statements in c program are terminated with a semicolon ; except few.
In this program we are a printf function which is used to print some thing on to the screen or console we can say.
Now that we have written our code which is called as source code but it is not understandable by the machine.Machine can only understand machine language(byte code),so after writing a code our next task will be to convert our source code in to the byte code to do that press Alt+F9
now a object code is created,next we need to execute the program for that ,press Ctr+F9,After this step executable file is created now we can run our program.To view the output press Alt+F5
In the next session we will discuss about C tokens.
No comments:
Post a Comment