/* Filename: C2FIRST.C
Program ne C qe paraqet komentet dhe tregon variablat dhe deklarimet e tyre */
#include <stdio.h>
main()
{
int i, j; /* Keto 3 rreshta deklarojne 4 variabla */
char c;
float x;
i = 4; /* i dhe j marrin numra te plote */
j = i + 7;
c = 'A'; /* karakteret vendosen ne thonjeza */
x = 9.087;
x = x * 4.5; /* Ndryshon vleren e x */
/* Dergon vleren e variablave ne ekran */
printf("%d %d %c %f", i, j, c, x);
return 0; /* Mbaron programin */
}
Rezultati: 4 11 A 40.891499
Perdorimi i hapesirave
/* Filename: C2FIRST.C Initial C program that
demonstrates the C comments and shows a few variables
and their declarations */
#include <stdio.h>
main() {int i,j;/* These 3 lines declare 4 variables */
char c;float x;i=4;/* i and j are assigned integer values */
j=i+7;c='A';/* All character constants are enclosed in
single quotes */x=9.087;/* x requires a floating-point
value since it was declared as a floating-point variable */x=
x*4.5;/*Change what was in x with a formula */ /* Sends the values of the
variables to the screen */printf(''%d %d %c %f",i,j,c,x);return 0;/* End programs and functions this way*/}
Germat e medha dhe te vogla
Perdorimi i hapesiraveKoleksion funksionesh
Funksionin kryesor: main
Blloku: pjesa brenda kllapave
Cdo instruksion mbaron me ;
/* pjesa brenda eshte koment */
// komentderi ne fund te rreshtit
Atributet
Variablat kane emer
Variablat kane tip
Variablat kane vlere
Deklarimi
Brenda nje funksioni
Perpara emrit te nje funksioni
main()
{
int i, j; // 2 rreshta deklarojne 3 variabla
char c;
Integer (numra te plote)
String
"Gjuha C" "123" "" "FSHN"
Karakter
'w' 'W' 'C' '7' '*' '=' '.' 'K'