Friday, October 8, 2010

Details of the test program in C programming language

On the last occasion, I've given the article how to make a simple program with C language, but then I have not provided details of the test program understanding about the commands that I use in making program. Therefore, in this article I will write down the details of the test program.

#include <stdio.h>
Tells C compiler to include the file "stdio.h" in this point of your C program before starting
compile step. This "include file” contains several definitions, declarations etc.



main()
C program consist of one or more functions. Functions are building blocks of C programs. main() function is different from other functions by that it is the start point of program execution. Our program contains only function while complicated programs may contain thousands.

{
Opening brace marks the start of a block. Closing brace will mark its end. This one marks main () function start

printf("Articles 4tatc.co.cc!");
This line of code prints the statement between quotation marks on your output screen. \n tells
program to start a new line in output screen.

Each command line in C ends with ";" character. Control statements are exceptions. You will
soon be able to determine when you must use ; to end a line of code.

system(“pause”);
The output window will close in Windows™, immediately after program execution has been finished. In this way you will not be able to see results of the execution (as it happens very fast). We have put this command to pause the window and wait for a keystroke before closing the window. You can remove this line from our examples if you do not use Windows operating system. This command actually sends the “pause” command to windows operating system and windows runs the its “pause” command at this point. We will learn more about this command in later lessons.

}
closes main() function.
This program contains only one function while complicated programs may contain several functions.

No comments:

Post a Comment