10 likes | 127 Views
This text delves into the classic "Hello World" program written in C, showcasing its primary function of outputting "Hello, World!" to the console. It illustrates the use of the `putc()` function from the `stdio.h` library to print each character individually, and highlights critical C programming concepts such as function definition, the `main` function's structure, and the importance of semicolons in statement conclusion. This serves as a fundamental introduction for beginners trying to grasp basic programming syntax and structure.
E N D
The Infamous “Hello World” Program The Infamous “Hello World” Program /* Block Comments */ // End-of-Line (new in C99) #include <stdio.h> /* putc(), stdout */ int main(void) { putc('H', stdout); putc('e', stdout); putc('l', stdout); putc('l', stdout); putc('o', stdout); putc(' ', stdout); putc('W', stdout); putc('o', stdout); putc('r', stdout); putc('l', stdout); putc('d', stdout); putc('!', stdout); putc('\n', stdout); return 0; } <> for Standard Include Directory “” for Current Directory first Preprocessor Directive Function call (or invocation) Statements end with semicolons. Argument List – comma separated Character Constant 4228160 (Borland TurboC/C++ v4.5) Function Definition ‘H’ = 72 (if ASCII is used) Type – “void” if nothing returned Name – EXACTLY one main() Parameter List – “void” of none taken int putc(int c, FILE *stream); Body = One Compound Statement