License, disclaimer of liability, and limited warranty


self- referential structure



Download 2,08 Mb.
Pdf ko'rish
bet365/393
Sana05.01.2022
Hajmi2,08 Mb.
#319699
1   ...   361   362   363   364   365   366   367   368   ...   393
Bog'liq
C Programming A Self Teaching Int 1uq45XL

self-
referential structure,
 which is used in the creation of linked lists and tree data structures. Also, we
compared arrays with structures and unions. Bit fields were also discussed. Using structures several
complex problems have been solved.
Exercises
Q1.
(a) Create a structure declaration for an employee of an organization consisting of the following


fields:
employee code, name, department, date of birth, date of hiring, basic salary
Write a program to print details of the employee, whose basic salary is greater than $20,000.
(b) Write short notes on union data types and enumerable data types.
Q2.
  Write  down  the  declarative  statement  that  creates  a  structure  consisting  of  the  following
information about books in the store:
Book-Id
4 characters
Book-Name
20 characters
Book-Price
real number
Num-copies
positive integer
How much memory is needed by this structure? Create two variables, b
1
 and b
2
, of this structure
type. Write down a statement in C to calculate the sum of books processed, represented by b
1
and b
2
.
[Hint:
        struct Book
         {
           char book-id [4];
           char book-name[20];
           float book-price;
           unsigned int num_copies;
         } b1, b2;
Total memory required by the structure: 30 bytes (i.e., 4 + 20 + 4 + 2 bytes = 30 bytes).
    The statements in C are:
    struct book b1, b2;
    flat sum;
    sum = b1.num_copies * b1.book-price + b2.num_copies * b2.book-price;

Download 2,08 Mb.

Do'stlaringiz bilan baham:
1   ...   361   362   363   364   365   366   367   368   ...   393




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