Hello viewer! In this post, we'll start learning our first program in C language.
Before we start our first program we need to understand the some basic concept. So Let's Start...
Header File
, #include
Note- "#" ( hash ) is the Preprocessor.
main()
printf("Welcome to Programming Language");
Note:
This is used for store the user value that they enter.
suppose, we have to create the Two Numbers Addition Program and the user enter two number like a=4, b=5 then the syntax looks like this..
printf("Enter Two Numbers");
scanf("%d%d", &a,&b); // These are the syntax of scanf. here the value 4 store in variable a & value 5 store in variable b.
getch()
#include
int main()
Before we start our first program we need to understand the some basic concept. So Let's Start...
Header File
- Header files contains the definition of functions and variables, which is used in C program by using the Preprocessor
- Header files with the extension ".h" ( Dot h )
- Some types of header files like.. "stdio.h", "conio.h", "math.h", "dos.h" etc.
- Types:-
- System Header Files - This type of header file is already saved/come with the compiler we do not need to change this header file.
- User Header File - These type of Header file is defined by the programmer like you. ( You are also a programmer :) )
- These are used to include the header file.
Note- "#" ( hash ) is the Preprocessor.
main()
- Every program in C we need to have a "main()" function. ( discuss in the future post )
- It means to start the execution of the program.
- These are used to print any message on the Screen.
printf("Welcome to Programming Language");
Note:
- do not forget the semicolon ( ; ) at the end of the printf.
- "printf" is predefined function, not a keyword.
This is used for store the user value that they enter.
suppose, we have to create the Two Numbers Addition Program and the user enter two number like a=4, b=5 then the syntax looks like this..
printf("Enter Two Numbers");
scanf("%d%d", &a,&b); // These are the syntax of scanf. here the value 4 store in variable a & value 5 store in variable b.
getch()
- getch() is a predefined function which is used for hold the output screen. if in a program we don't see the output of the program it was to fast . to hold the output screen we need to declare the getch() function.
Now Friend let's start with our first program to print "Hello Baby" on the screen...
Program :
#include
#include
int main()
{
printf("\nHello Baby");
getch();
}
Now let's Understand all the part of code/program...
#include
- The function is used for generating output is define in stdio.h.
- In order to use the printf function we need to include the library file in which their explanation called Header File.
- It means standard Input/Output.
- It means Console Input/Output.
- This is also a type of header file in which declaration of getch function.
- Every C programs in C contain a main() function as the entry point to control of program.
- Curly brackets "{}" indicates the begining and the end of a function ( also called a Code Block )
printf("\nHello Baby");
- In this printf is the function used for print any message on screen here we pass "Hello Baby" to it.
- \n ( escape sequence ) used to print message in new line.
- Escape Sequence always begin with backlash ( \ ) .
- The semicolon ( ; ) indicates the end of the statement.
and last getch() is already discussed in the above line.
In this post are so enough 4 today. I hope you like it.
Thank You 4 reading my blog! if you have any problem or issue with this post please comment/contact.