8escs01 problem solving through programming unit-2: c programming basics



Download 0,98 Mb.
bet10/22
Sana19.05.2023
Hajmi0,98 Mb.
#940862
1   ...   6   7   8   9   10   11   12   13   ...   22
Bog'liq
Module 2 c program

38

VARIABLES


(i) DECLARING VARIABLES:
  • The declaration of variables should be done in the declaration part of the program.
  • The variable must be declared before they are used in the program.
  • Declaration provide two things:
    • Compiler obtain variable name.
    • Compile allocate memory for variable according to the data type.
  • Syntax: Data_type variable name;
  • Example: int age;

float s; char m;
39

VARIABLES


40
(ii) INITIALIZING VARIABLES:
  • Variables declared can be assigned or initialized using an assignment operator =
  • The declaration and initialization can also be done in the same line.
  • Syntax: variable_name = constant;

  • (or)
    Data_type variable_name = constant;

o Example: Y = 5;
int z = 15; char ch = ‘s’;

VARIABLES


(iii) CONSTANT VARIABLES:
  • The constant variables are used to remain unchanged value during the execution of the program.
  • It can be done only by declaring the variable as a constant.
  • Syntax: const data_type variable_name = value;
  • Example: const int m = 10;

VARIABLES


(iv) VOLATILE VARIABLES:
  • The volatile variables are those variables that are changed at any time by other external program.
  • Keyword : volatile
  • Syntax: volatile data_type variable_name;
  • Example: volatile int d;

EXPRESSION USING OPERATORS IN ‘C’

OPERATORS AND EXPRESSIONS

  • Conditional Operators
  • Bitwise Operators
  • Special Operators

44
  • An Operator is a symbol that specifies an operation to be performed on the operands.
  • The data items that operators acts upon are called Operands.
  • An Operation indicates an operation to be performed on data that may yield a new value.
  • An operator can operate on integer, character and floating point numbers.


  • Download 0,98 Mb.

    Do'stlaringiz bilan baham:
1   ...   6   7   8   9   10   11   12   13   ...   22




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish