Learn C Programming in 7 Days only
Now we make a first hello world application.
#include <conio.h>
void main()
{
printf("Hello World.");
getch();
}
Lets Start......
First we have to know what is C??
Ans: C is a programming language developed by Dennis Ritchie between 1969 & 1973 at AT&T Bell Laboratory.
- It is structured programming language.
- It allow recursion and lexical variable scope.
- It is portable language i.e. It available on all platform like Mac,Windows, Unix.
- User-defined types are allowed in C by a typedef function.
- There is small fixed number of keywords i.e. if,else, while, do etc.
- There are large number of arithmetic and logical operators.
Now we make a first hello world application.
- Open Turbo C. (Download it from here work on WIN7 & WIN8)
- Open a new file.
- Now write:
#include <conio.h>
void main()
{
printf("Hello World.");
getch();
}
Now run the program....
Let us explain....
Let us explain....
#include -> This will include the support file like stdio.h, conio.h, math.h
stdio.h -> This provide the common function like printf, scanf etc.
conio.h -> This provide the common function like clrscr, getch etc.
void -> This is a type which return/give null(empty) value.
main() -> This is a function. When program run this function first called by the compiler.
Note: On defining the function means when creating a function it must have a type.
Example: void main, int main, char hello, void hi
And the default structure is as follow:
--------------------------------------------------
int void()
{
//functions goes here
}
-------------------------------------------------
void hello()
{
}
--------------------------------------------------
printf() -> It is a function which write on the console.
Example:
printf("This is a test"):
printf("How are you");
getch() -> It wait for a key. if it exclude from the program then after writing the output it disappear.
No comments:
Post a Comment