php java c++ Visual Basic c# Delphi API PERL HTML TML JavaScript ASP XML Oracle MySql sql server Access

    

  F.Abdelaziz
F.Abdelaziz
:: ::
: May 2007
: 6,894
[ F.Abdelaziz ]
:328
11-01-2014, 11:33 AM 1   
: : Introduction to C Twitter FaceBook Google+



: Introduction to C Programming

" " .
. .

: Overview of C :
:
:
. .

:
() .

:
.

.
:
.
() .
( ) .
.
.
. .

:
:
:
:
Edit Compile Link () Run
. . : () .








Editing :
. " " . . " " source file . "" ".c" .

Compiling :
" " . " " . object file ".obj" .

Linking :
: "" ( ) . / () . (stdio.h) .
(.exe) .

:
(.c) (.obj) (.exe) . .


  F.Abdelaziz
F.Abdelaziz
:: ::
: May 2007
: 6,894
[ F.Abdelaziz ]
:328
11-01-2014, 11:35 AM 2   


: () :
:
:
character .
keyword .
() .
.
.
" " .

1- C's Character Set :
. :

:
A Z a z 0 9 space . , : ; ' $ " # % & ! _ {} [] () < > | + - / * =
.

2- :
"" function ( ) . "" main . () . .
32 . . . . "auto" .

3- layout :
( ) :






:
() {} . () {} ( ) .
. "" . . . spaces . . ( ) .

4- Preprocessor Directives :
. . stdio.h ( ) . (.h) header .
. .
(#) ( ) . :

:
#include <stdio.h>
< > . .
:

:
#include "stdio.h"
" " .

:
include # .

.

( )
  

  F.Abdelaziz
F.Abdelaziz
:: ::
: May 2007
: 6,894
[ F.Abdelaziz ]
:328
11-01-2014, 12:42 PM 3   


: :
:
:
" " .
.
"" comments .

. "Hello World" . "Hello World" .
:
:
#include <stdio.h> int main() { printf("Hello World\n"); }

() main() . {} . {} "" .
"" . . .

{} ! () . . :

:
main(){printf("Hello World\n");}


.

printf "" . "\n" "" " " ( ) .
.
Hello.c . . :


:
Hello World


comments :
"" . . . . . .
" " (/*) ( ) " " (*/) ( ) :

:
/* This is a comment. */

. . .
:


:
main() /* main function heading */ { printf("\n Hello, World! \n"); /* Display message on */ } /* the screen */


.


  F.Abdelaziz
F.Abdelaziz
:: ::
: May 2007
: 6,894
[ F.Abdelaziz ]
:328
11-01-2014, 12:44 PM 4   


:
Dev-C++ .
Dev-C++ IDE C / C++ . :
:
.





File New Source file :






:





Hello.c ( c ) .






Execute Compile :





Close :




: Run Hello World .

:
getch(); printf .








  soukdok
soukdok
:: ::
: Sep 2012
: 166
[ soukdok ]
:0
11-01-2014, 03:03 PM 5   
x3


:
; ;
. .. . .......


: soukdok 11-01-2014 03:11 PM

  F.Abdelaziz
F.Abdelaziz
:: ::
: May 2007
: 6,894
[ F.Abdelaziz ]
:328
11-01-2014, 04:40 PM 6   


:
; ; . .. . .......






  F.Abdelaziz
F.Abdelaziz
:: ::
: May 2007
: 6,894
[ F.Abdelaziz ]
:328
11-01-2014, 04:57 PM 7   


: Data Types :
:
:
:
declare () local .
initialize .
() .
. . . .

"" . "" variable " " " " ( ) .
" " "" .
" " ( ) global .

" " :
int integer .
float .
double .
char .
void ( ) .

" _ " .

1- :
int . int -32768 to +32767 . .
int :

:
int variable name;

:
int "a" :

:
int a;


:
:
a=10;


:
"=" "" .
a=10 " 10 a " .
"=" "" :

:
a=a+10;


" ( ) a 10 ( ) a" .

2- ( ) :
. "" counting .
: float double :

Ý- float :
7 1.E-36 1.E+36 .
ȝ- double :
13 1.E-303 1.E+303 . 8 .

:
:
float total; double sum;


:
:
total=0.0; sum=12.50;


3- "" character :
"" "" .
char .
.
:
:
char c;


" " char : ' ' . c char A :

:
c='A'


:
char .
strings " " .
char 'A' "A" .

:
.
. :

:
name = value;

:

:
a=10;


10 a int .
!
.

: a,b float :
:
a+b
:
a-b
:
a*b
:
a/b

: "+" "-" "*" "/" .
:
() :

:
a=10/3

() " a " :
int "3" .
float "3.333" .
:
1- .
2- float .

:
:

:
a=10.0 + 2.0 * 5.0 - 6.0 / 2.0

27 . . 17 .
:
:
a=10.0 + (2.0 * 5.0) - (6.0 / 2.0) a=(10.0 + 2.0) * (5.0 - 6.0) / 2.0



int float double . . "f*i" f float i int int float . float . . .

char int float double . ASCII 0 255 ( ) . char 0 255 .

:
. " " . int i .
:

:
int a, b, c;

int a,b,c . . .


  F.Abdelaziz
F.Abdelaziz
:: ::
: May 2007
: 6,894
[ F.Abdelaziz ]
:328
11-01-2014, 04:59 PM 8   


:
. printf :

:
/*example2 Another simple program using int and printf */
#include <stdio.h>
main() { int a,b,average; a=10; b=6; average = ( a+b ) / 2 ; printf("Here "); printf("is "); printf("the "); printf("answer... "); printf("\n"); printf("%d.",average); }















:
() :

:
int i=1;


i . :

:
int i; i=l;


.
. .



«                »




+3 : 12:14 PM


( )

- - -
Powered by vBulletin® Version 3.8.6, Copyright ©2000 - 2024