Posts

Showing posts with the label global and local variables

Programming In C, main() function, global and local variables, Comments in C Language

Image
Question 1.  Describe the purpose of the  main () function and the body  of  main() function Ans:   Every C program must  have the function main() which  is the first section to be executed  when the program runs. The word void before the  function main() means that this function does not return a  value and the second void inside the brackets means it  does not have any argument. When we run a program  the main() function is always executed first no matter  where it appears in the program. The body of main() Function . The body of the function main() is surrounded by braces {}. The left brace indicates the start of the body of the function and the right brace indicates the end of the body of the  function. Question 2: Define global and local variables. Ans : Variables are used in C program to store values. Global Variables:   Global variables are declared before the main() function.  These variables are use...