Assignment#5

1 view
Skip to first unread message

Anurag Mishra

unread,
Jun 23, 2011, 1:23:18 AM6/23/11
to C summer class

1. What will be output of following c code?

void main()
{
struct employee
{
unsigned id: 8;
unsigned sex:1;
unsigned age:7;
};
struct employee emp1={203,1,23};
clrscr();
printf("%d\t%d\t%d",emp1.id,emp1.sex,emp1.age);
getch();
}

2. What will be output of following c code?

void main()
{
struct india
{
char c;
float d;
};
struct world
{
int a[3];
char b;
struct india orissa;
};
struct world st ={{1,2,3},'P','q',1.4};
clrscr();
printf("%d\t%c\t%c\t%f",st.a[1],st.b,st.orissa.c,st.orissa.d);
getch();
}

3. What is the difference between a two-dimensional array and two
parallel arrays?
4. Which is the correct function prototype for a function that accepts
a 2-dimensional integer array that is of size array[3][3]?
5. Define array of structures with a program.
Reply all
Reply to author
Forward
0 new messages