• admin@embedclogic.com

Your First C Program

Although even you are not familiar with the C keywords, Data types, operators, and Concepts but don’t need to worry.I have taken “Hello World” example just to explain basic framework of C language.

Our Task is to write a program to print “Hello World” on Console.So first you shall create CodeBlock project as I explained in the previous chapter.

Write this code on your CodeBlock editor and build(ctrl+f9) and run(ctrl+f10).

Output :

keyword in basic C Function

stdio.h:     standard input-output library

This library contains all the input and output related function’s definition.Output function like printf() and input function like scanf() has its definition inside this library.

#(HASH)  is used as a prefix with a keyword and these statements will first process by the compiler when we build the program.

so , #include<stdio.h> means include the stdio.h header file with the current program as a first step taken by the compiler during compilation.

main() : entry function of c project

 C function Syntax:

         returnValue function_name(arg 1 , arg 2, … arg n)


/*body of function*/


see the below main function syntax:

main function syntax

main is predefined and reserved keyword for the entry function name of  every C project.A programmer writes all the procedures inside main and they execute one by one.

structure of the main function is standard and the input passed inside the main is also predefined and optional if a programmer doesn’t need to pass any value from the outside world. If programmer need to pass input from the console at run time then it would be taken care by below parameters of the main function.

 argc: Argument Count(Number of the argument passed by command line prompt)

 argv[]: Pointer to the array of argument buffer which has input values.

Keyword Used in main()

int (return value) tells about the data type of the output of the main function.

printf() is an output function, defined in the stdio library will take “Hello World” as an input and will print same on console.

scanf() is an input function, also defined in the standard library, not use in above program(not required in this program), shall use when we have to give some input at runtime from outside.

return is the keyword used to return function’s output.

Subscribe and stay updated with our latest articles.

You have successfully subscribed to the newsletter

There was an error while trying to send your request. Please try again.

Embedclogic will use the information you provide on this form to be in touch with you and to provide updates and marketing.