A Simple C Program: Printing a Line of Text

A Simple C Program: Printing a Line of Text

C uses some notations that may appear strange to people who have not programmed computers.
I begin by considering a simple C program. First example prints a line of text. The program and its screen output are shown

1 // Fig. 2.1: fig02_01.c
2 // A first program in C.
3 #include <stdio.h>
5 // function main begins program execution
6 int main( void )
7 {
8 printf( "Welcome to Programming World!\n" );
9 } // end function main


Welcome to Programming World!

Even though this program is simple, it illustrates several important features of the C language. Lines 1 and 2

#include Preprocessor Directive Line 3 is a directive to the C preprocessor. Lines beginning with # are processed by the preprocessor before compilation. Line 3 tells the preprocessor to include the contents of the standard input/output header () in the program.