C language

Two commonly used functions for I/O (Input/Output) are printf() and scanf().

C Output

#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

How this program works?

  • All valid C program must contain the main() function. The code execution begins from the start of main() function.
  • The printf() is a library function to send formatted output to the screen. The printf()function is declared in "stdio.h" header file.
  • Here, stdio.h is a header file (standard input output header file) and #include is a preprocessor directive to paste the code from the header file when necessary. When the compiler encounters printf() function and doesn't find stdio.h header file, compiler shows error.
  • The return 0; statement is the "Exit status" of the program. In simple terms, program ends.

 

 


Return to top