#include <stdio.h>
int main()
{
/* my first program in C */
printf("Hello, World! \n");
return 0;
}
The first line of the program #include <stdio.h> is a preprocessor directive which tells a C compiler to include the contents of file stdio.h. This include file is a separate file that contains additional information used by the program file during compilation. stdio.h file stands for standard input-output header file and contains various prototypes and macros to perform input or output (I/O)
The main() function is where the program execution begins and is required by every executable C program. Every function must include a pair of braces which mark the beginning and end of the function. Within the braces are statements that make up the main body of the program
Any part of your program that starts with /* and ends with */ is called a comment and is ignored by the compiler. Comments are used by the programmer to explain their code but do not affect the running of the code
The printf() statement is a library function that displays information on-screen. In this instance, printf outputs the contents of the quotation marks followed by a new line \n.
All functions in C can return values. The main() function itself returns a value and in this case, the value 0, indicates that the program has terminated normally. A nonzero value returned by the return statement tells the operating system that an error has occurred.
In C, the semicolon acts as a statement terminator and indicates to the parser where a statement ends. Several statements can be included on one line as long as each statement is terminated with a semicolon.
Last Updates:25 October 2022