C Language Tutorial

  • Work-from-home

Mahen

Alhamdulillah
VIP
Jun 9, 2012
21,845
16,877
1,313
laнore
Assalam o Alykum

it's just a quick tutorial for every beginner who want to learn C,
i think @Hoorain ab tumy samaj aa jaye gie programming ki :p

don't waste time anymore 'my tea cup is finished now let's get started {(jccoffe)}

first of all you have to know about C standard libraries or header files ..!
without including that, you can't even coding a bit in C or C++ .

Let's take a look at some important one.


*<iostream> : this one is stand for (input/output stream) and use to get input from user and give output message to users screen(it's use for C++)


<stdio.h> : stdio stand for (standard input/output) also use to get input and shows output message on screen. but it has some other more functions(see latter)


<cmath.h> : if you are gonna use math's function in your program then it's recomended to inlude cmath


<conio.h> : stand for (console input/output), also use to get input and shows output on screen ,but it has some built it functions(see latter)


<string.h> : use for string functions (very usefull)


<windows.h> : use for windows apps


There are alot more (Google it), but em not gonna cover everyone as beginner you will just face these one's ..!


*The syntax for including header files are

#include <header_file_name>

ok now let's take a look at <conio.h> and <stdio.h>.

#inlcude <conio.h> : it's use for getting input and showing input message on screen but it has some other built in functions like :


*clrscr() : stand for clear screen use to clear the contents of screen.


*getch() : stand for Get Character. The function use to get single character from user, your console will be paused untill you give any sngle character.
The character user entered can also stored in variable. e.g

ch = getch;

the console window will be paused until you give any character suppose you give (*) . the (*) character will saved in (ch) variable.

i don't want to give you more ass pain :p (Google it for more)

now come at stdio.h (standard input/output)


#iclude <sdtio.h> : it also contains different function that use in tha task of input and output

common functions:

*getchar(): This works similar as getch() works in conio.h header.

*putchar() : stand for Put Character use to display single character using stdio.h header.


*gets() :Stand for Get String use to get input from user.

Enough for header files or C standard libraries for more again google it :p


without wasting time let's make a simple hello world program, In addition i will put comments for every line. for your better understand..!!

let's get started :



Code:
#include <stdio.h>    //header file for input output
 
main(){        //main fucntion starts
//within these brackets {} << we can wirte our execution code
 
printf("Hello world"); //printf function use to get output message show on screen
 
getchar(); //this will puase your console window untill you press any character
 
//without getchar() function your program will run so fast try running your program without getchar()
 
//semi colon(;) are recomended in c language after any command
 
}// main fucntion ends

To Be Continue ..!
 

Hoorain

*In search of Oyster Pearls*
VIP
Dec 31, 2009
108,467
40,710
1,313
A n3st!
wowwwww maheenu aap kinni mehanti kuri ho :-bd
superb thread,,n dont worry muje kabhi samajh nhi aani programming:p
Thread is really informative .,,,Congratz beginners maheenu teacher aapki class laingi ;)
 
  • Like
Reactions: Maheen_Hassan

Mahen

Alhamdulillah
VIP
Jun 9, 2012
21,845
16,877
1,313
laнore
wowwwww maheenu aap kinni mehanti kuri ho :-bd
superb thread,,n dont worry muje kabhi samajh nhi aani programming:p
Thread is really informative .,,,Congratz beginners maheenu teacher aapki class laingi ;)
inna easy way mein sub samjya hai /:) ab bhi u ko samaj nhi aii nalak kuri :-ss :D
beginners mein 1st one tum ho /:) baki bd mein :p
kal many ye last wala program krwa k dhakna hai tum sy :p
 

Hoorain

*In search of Oyster Pearls*
VIP
Dec 31, 2009
108,467
40,710
1,313
A n3st!
inna easy way mein sub samjya hai /:) ab bhi u ko samaj nhi aii nalak kuri :-ss :D
beginners mein 1st one tum ho /:) baki bd mein :p
kal many ye last wala program krwa k dhakna hai tum sy :p
kal kio abhi karwa k daikh lo,,copy paste may time hi kitna lagta hay :D :p
 

Shiraz-Khan

Super Magic Jori
Hot Shot
Oct 27, 2012
18,264
15,551
1,313
Assalam o Alykum

it's just a quick tutorial for every beginner who want to learn C,
i think @Hoorain ab tumy samaj aa jaye gie programming ki :p

don't waste time anymore 'my tea cup is finished now let's get started {(jccoffe)}

first of all you have to know about C standard libraries or header files ..!
without including that, you can't even coding a bit in C or C++ .

Let's take a look at some important one.


*<iostream> : this one is stand for (input/output stream) and use to get input from user and give output message to users screen(it's use for C++)


<stdio.h> : stdio stand for (standard input/output) also use to get input and shows output message on screen. but it has some other more functions(see latter)


<cmath.h> : if you are gonna use math's function in your program then it's recomended to inlude cmath


<conio.h> : stand for (console input/output), also use to get input and shows output on screen ,but it has some built it functions(see latter)


<string.h> : use for string functions (very usefull)


<windows.h> : use for windows apps


There are alot more (Google it), but em not gonna cover everyone as beginner you will just face these one's ..!


*The syntax for including header files are

#include <header_file_name>

ok now let's take a look at <conio.h> and <stdio.h>.

#inlcude <conio.h> : it's use for getting input and showing input message on screen but it has some other built in functions like :


*clrscr() : stand for clear screen use to clear the contents of screen.


*getch() : stand for Get Character. The function use to get single character from user, your console will be paused untill you give any sngle character.
The character user entered can also stored in variable. e.g

ch = getch;

the console window will be paused until you give any character suppose you give (*) . the (*) character will saved in (ch) variable.

i don't want to give you more ass pain :p (Google it for more)

now come at stdio.h (standard input/output)


#iclude <sdtio.h> : it also contains different function that use in tha task of input and output

common functions:

*getchar(): This works similar as getch() works in conio.h header.

*putchar() : stand for Put Character use to display single character using stdio.h header.


*gets() :Stand for Get String use to get input from user.

Enough for header files or C standard libraries for more again google it :p


without wasting time let's make a simple hello world program, In addition i will put comments for every line. for your better understand..!!

let's get started :



Code:
#include <stdio.h>    //header file for input output
 
main(){        //main fucntion starts
//within these brackets {} << we can wirte our execution code
 
printf("Hello world"); //printf function use to get output message show on screen
 
getchar(); //this will puase your console window untill you press any character
 
//without getchar() function your program will run so fast try running your program without getchar()
 
//semi colon(;) are recomended in c language after any command
 
}// main fucntion ends

To Be Continue ..!
ws....
wah!!! Maheen tu chaah gae... nice way n nicely sekhaeing :D
keep it up!!! means programing filhaal Maheen k palley parh rae hey :p
 
  • Like
Reactions: Maheen_Hassan

Azeyy

•´¯`•» RuDleSS AzeYY «•´¯`•
VIP
Aug 17, 2012
12,084
5,479
513
lahore
wowwwww maheenu aap kinni mehanti kuri ho :-bd
superb thread,,n dont worry muje kabhi samajh nhi aani programming:p
Thread is really informative .,,,Congratz beginners maheenu teacher aapki class laingi ;)
Huff kabi b nai ye nai hu sakta.........:p
 
Top