The document discusses code for a simple C program that prints "C Programming" using the printf function. It explains that #include directives tell the preprocessor to include header files containing function declarations. The #include<iostream> line includes declarations for standard input/output, while #include<stdio.h> is needed for printf. The main function contains the printf statement to display the text, and returns 0 at the end to indicate successful program completion.
1 of 1
Download to read offline
More Related Content
#Include
1. #include<iostream>
Lines beginning with a pound sign (#) are used by the compilers pre-processor. In this case the
directive #include tells the pre-processor to include the iostream standard file. This file iostream
includes the declarations of the basic standard input/output library in C++. (See it as including
extra lines of code that add functionality to your program)
include <stdio.h> //This is needed to run printf() function.
int main()
{
printf("C Programming"); //displays the content inside quotation
return 0;
}
Output
C Programming
Explanation of How this program work s
1. Every program starts from main() function.
2. printf() is a library function to display output which only works if #include<stdio.h>is
included at the beginning.
3. Here, stdio.h is a header file (standard input output header file) and #include is command to
paste the code from the header file when necessary. When compiler encounters printf()function
and doesn't find stdio.h header file, compiler shows error.
4. Code return 0; indicates the end of program. You can ignore this statement but, it is good
programming practice to use return 0;.