It is processed before compiling the program. A preprocessor directive begins with hash sign ( #). Preprocessor Directive: The #include (Line 4) is a preprocessor directive and NOT a programming statement. It must be terminated by a semi-colon ( ) (just like an English sentence is ended with a period) as in Lines 7 and 8. Statement: A programming statement performs a piece of programming action. C compiler will implicitly insert a " return 0 " to the end of the main() function. Typically, return value of 0 signals normal termination whereas value of non-zero (usually 1) signals abnormal termination. Terminates the main() function and returns a value of 0 to the operating system. The newline ( \n) brings the cursor to the beginning of the next line. We invoke the function printf() to print the string "Hello, world!" followed by a newline ( \n) to the console. main() is required to return an int (integer). The main() function is the entry point of program execution. I will explain its meaning later.ĭefines the so-called main() function. This line shall be present in all our programs. The directive " #include " tells the preprocessor to include the " stdio.h" header file to support input/output operations. A preprocessor directive begins with a # sign, and is processed before compilation. The " #include" is called a preprocessor directive. End-of-line Comment: begins with // and lasts until the end of the current line (as in Lines 4, 6, 7, 8, and 9).It may span more than one lines (as in Lines 1-3). Multi-line Comment: begins with /* and ends with */.But they provide useful explanation and documentation to your readers (and to yourself three days later). Comments are NOT executable and are ignored by the compiler. UNIX/Linux/Mac (Bash shell) - Run "Hello" (./ denotes the current directory) Windows (CMD shell) - Run "Hello.exe" (.exe is optional)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |