Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
54 views2 pages

Program 1 - Pahul

The document discusses printing "Hello World" in C programming. It provides explanations of key concepts needed like pre-processor directives, header files, functions, main(), printf(), and getch(). The sample program uses #include to import header files, printf() to print the text, and getch() to pause the output. When run, the program displays "Hello World" as the output.

Uploaded by

Nikhil Rathore
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views2 pages

Program 1 - Pahul

The document discusses printing "Hello World" in C programming. It provides explanations of key concepts needed like pre-processor directives, header files, functions, main(), printf(), and getch(). The sample program uses #include to import header files, printf() to print the text, and getch() to pause the output. When run, the program displays "Hello World" as the output.

Uploaded by

Nikhil Rathore
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

PROGRAM 1

OBJECTIVE:
To print Hello World.

THEORY:
Pre-processor Directive-
The C pre-processor is a macro processor that is used automatically by the C compiler to
transform the program before actual compilation. The pre-processor commands come at the
beginning of the program. All such commands start with a pound sign(#). The # is followed by an
identifier that is the directive name.
#include-
The #include pre-processor directive is used to paste code of given file into current file. It is used
to include system-defined and user-defined header files. If included file is not found, compiler
renders error.
Header Files-
A header file is a file with extension .h which contains C function declarations and macro
definitions to be shared between several source files. There are two types of header files:
the files that the programmer writes and the files that comes with your compiler.
stdio.h-
It stands for standard input/output header file.
conio.h-
It stands for console input/output.
Function-
A function is a group of statements that together perform a task. Every C program has at least
one function, which is main(), and all the most trivial programs can define additional functions.
main() -
main() function is the entry point of any C program. When a C program is executed, the execution
control goes directly to the main() function.
printf()
printf() function is an inbuilt library function in C programming language. It is declared and related
macros are defined in stdio.h which is a header file in C language. It is used to print the character,
string, float, integer, octal and hexadecimal values onto the output screen. printf() function
with %d format specifier is used to display the value of an integer variable. Similarly %c is used to
display character, %f for float variable, %s for string variable, %lf for double and %x for
hexadecimal variable.

getch()-
getch() reads a single byte character from input. It is a way to get a user inputted character. It can
be used to hold program execution, but the "holding" is simply a side-effect of its primary purpose,
which is to wait until the user enters a character.
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
{
printf(Hello World);
getch();
}

OUTPUT:

RESULT:
We are able to print Hello World.

CONCLUSION:
Using printf() command, Hello World was printed.

You might also like