Pre-Test
- What is a structure in C language.?
- What is the size of a C structure.?
- What is the output of C program with structures.?
int main()
{
structure hotel
{
int items;
char name[10];
}a;
strcpy(a.name, "TAJ");
a.items=10;
printf("%s", a.name);
return 0;
}
} - Choose a correct statement about C structures.
- What is the output of C program with structure arrays.?
int main()
{
struct pens
{
int color;
}p1[2];
struct pens p2[3];
p1[0].color=5;
p1[1].color=9;
printf("%d ",p1[0].color);
printf("%d",p1[1].color);
return 0;
}
A structure is a collection of elements that can be of same data type.
A structure is a collection of elements that can be of different data type.
Elements of a structure are called members.
All the above
C structure is always 128 bytes.
Size of C structure is the total bytes of all elements of structure.
Size of C structure is the size of largest element.
None of the above
TAJ
Empty string
Compiler error
None of the above
A structure can contain same structure type member.
A structure size is limited by only physical memory of that PC.
You can define an unlimited number of members inside a structure.
All the above.
5 5
5 9
9 5
Compiler error
