What do you mean by Program? Briefly describe the basic structure of C programs.
Parts of C program-
# include <stdio.h> – This command is a preprocessor directive in C that includes all standard input-output files before compiling any C program so as to make use of all those functions in our C program.
int main() – This is the line from where the execution of the program starts. The main() function starts the execution of any C program.
{ (Opening bracket) – This indicates the beginning of any function in the program (Here it indicates the beginning of the main function).
/* some comments */ – Whatever is inside /*——-*/ are not compiled and executed; they are only written for user understanding or for making the program interactive by inserting a comment line. These are known as multiline comments. Single line comments are represented with the help of 2 forward slashes “//——”.
printf(“Hello World”) –The printf() command is included in the C stdio.h library, which helps to display the message on the output screen.
getch() – This command helps to hold the screen.
return 0 –This command terminates the C program and returns a null value, that is, 0.
} (Closing brackets)- This indicates the end of the function. (Here it indicates the end of the main function)
It also uses 3 control structures that is sequence, selection and looping structures.
Comments
Leave a comment