Structure of a C program

welcome again my boiz and girls today we are going to discus how a structure of  a C program basically looks like 

 this is how its look like...



A c program is composed of preprocessor commands, a global declarations and one or more functions in the program.

1.)a preprocessor directive  a preprocessor is a program that is executed , before your source code(your program) is passed to compiler(a program that converts instructions into a machine-code or lower-level form so that they can be read and executed by a computer.
),always remember that the preprocessor command are always preceded with # symbol.It is usually palced before the main function but it can appear in anywhere in program code(just dont try it to place between these (   )  and place before they are used in program,if they are placed in between then they are applied to the rest of the code ).
2.) a gloabal declaration consist of declaration of global variable (we will discuss in detail in our later blogs)
just remember it for now that we can use that variable  any where in our program (called as global scope ,we will also dicuss later with a great detail)

3.) c program contains one or more functions in it where function is defined as a group of c statements that is used to perform a specific tasks,most important that every execution of a c program starts with the main fucntion only

4.)  all the function including the main function have declaration and definition

so now you will question that what the hell is that?


function declaration basically tells the compiler the specific function name and the type of arguments (void in this case or empty) are gonna be used in program and definition consist of  code that manipulates that data to perform specific work remember that function declaration must precede the definition,(the main declaration is done within the compiler itself so we don't declare it in out program).

5.) Note that a basic c program execution without function starts form top to bottom.

6.) from the structure we can conclude that the program can have as many function depending on the task that have to be performed and each function can have number of statements.

(local declaration are type of declaration which can be used in the function itself only
these come under the scope topic )
(i know im creating lot of suspense but im giving you the overveiw of all the things which comes under the specific topic im explaning,comment down below if you have doubt or suggestion i will do my best to answer them doubts,thank you)

(leave the comment down below if you have a doubt or suggestions ,thnks🙂)

No comments:

Post a Comment

Contact Form

Name

Email *

Message *