Saturday, December 29, 2018

STRUCTURE OF C PROGRAM

c programming,jquery,xamarin,selendroid,appium,coded ui,selenium,bangalore,rajajinagar,bootstrap,ios,asp.net mvc,c sharp,c#,ankpro training,ankpro,native language,kid,android,manual testing,tips and tricks,scanf,help,first,computer science (field of study),structured programming (programming language paradigm),comments,clrscr,main,printf,mobile testing,c#6,c#7,azure,knockout,angular,best training,computer training,training,kannada,ankit,maker

                STRUCTURE OF, 'C ' PROGRAM

Before  understanding the structure of  C  program you must know these important points:

* 'C' is a case-sensitive language, it means all the keywords must be written in lower case.
* Keywords can't be used as variable or functions name.
* Every interaction should end with (;)sign:
* Preprocessor main ( ) is must for a program.

NOW TO WRITE A PROGRAM IN  'C' WE NEED TO FELLOW THESES STEPS:

* Define preprocessor directive ( include header files according to prototype Function, standard I/O library function to be used).
* Open function main ( )
* Assign data type and Variables.
* Define the body of the function
* End the function main ( )

EXAMPLE

/* Harsh.c: the first example for students*/

#include<stdio.h>
void main()
{
int a=10, b=15, c;
printf("HELLOW STUDENTS"\n");
c=a+b;
print ("the sum of %d and %d is %d, a,b,c);
}
NOTE: THIS PROGRAM WAS ONLY TOLD TO EXPLAINATION TO YOU.PLEASE DO NOT PAY ATTENTION TO IT'S OUTPUT.

Explanation


First line


IN THE ABOVE EXAMPLE THE FIRST LINE.
/*harsh.c first exmple for students*/
is a comment and non-executable.Comment in 'C' begins with (/*) and ends with(*/).

Second line


#include<stdio.h>
is a preprocessor directive. The preprocessor processes the 'C'  program before the compiler. Here stdio.h is a header file consists of standard I/O Function. A header file related to the function used in the program should be included at the beginning.

THE LINE

void main( )
Indicates "the beginning of the program".The compilation of the program starts from main( ) function.
{, symbol indicates the beginning of main() function.

The line


int a=10,b=15,C;
is for declaration of Variables and data types.
Imp:- int included the only real number.

The Lines


Printf("The sum of %d and %d is %d,a,b,c);
are the body of the program.
and symbol '}' indicates end of main ( ) function.


NOTE: THIS PROGRAM WAS ONLY TOLD TO EXPLAINATION TO YOU.PLEASE DO NOT PAY ATTENTION TO IT'S OUTPUT.