What is the similarity between a structure, union and enumeration?

Home | Discussion Forum

What is the similarity between a structure, union and enumeration?

View More Related Question

1) What is the output of this C code?

#include <stdio.h>
void main()
{
struct student {
int no;
char name[20];
};
struct student s;
no = 8;
printf("%d", no);
}

2) Number of bytes in memory taken by the below structure is

#include <stdio.h>
struct test {
int k;
char c;
};

3) Which of the following are themselves a collection of different data types?

4) What is the similarity between a structure, union and enumeration?

5) Can the below code be compiled successfully?

#include <stdio.h>
struct p {
int k;
char c;
float f;
};
int main()
{
struct p x = {.c = 97, .f = 3, .k = 1};
printf("%f\n", x.f);
}

UP Gk Online Test

taiyari24hour.com