Posts

Showing posts with the label header file

First C Program

Image
Your First C Program Here, is a Hello World program in C #include<stdio.h> //Pre-processor directive void main() //main function declaration { printf("Hello World"); //to output the string on a display getch (); //terminating function } Here is the code explanation: Pre-processor directive #include is a pre-processor directive in 'C.' #include <stdio.h> , stdio is the library where the function printf is defined . printf is used for generating output. Before using this function, we have to first include the required file, also known as a header file (.h). You can also create your own functions, group them in header files and declare them at the top of the program to use them. To include a file in a program, use pre-processor directive #include <file-name>.h File-name is the name of a file in which the functions are stored. Pre-processor directives are always placed at the beginning of the program. The main function The