Semester : S1 and S2
Subject : Computer Programming
Year : 2017
Term : DECEMBER
Branch : BIOTECHNOLOGY
Scheme : 2015 Full Time
Course Code : CS 100
Page:21
न्न
Structure allocates storage space for all its members Union allocates one common storage space for all its
separately. members.
Union finds that which of its member needs high storag
space over other members and allocates that much space
Structure occupies higher memory space. Union occupies lower memory space over structure.
We can access all members of structure at a time. We can access only one member of union at a time.
Structure :| Union example: union student
struct { 8 1
int char int mark; char name[6]; double average;
double
॥8
b) Compare Structure and Union with help of example. (5)
c) Write a C program largest number in an Array (5)
#include
main()
{ int array[50], size, i, largest; printf("\n
Enter the size of the array: ");
scanf("%d", &size); _ printf("\n Enter %d
elements of the array: ", 5126); for (i=