C Algorithm
Date: Jul 2012
Level: Basic


INTERVIEW QUESTIONS

Company: Cisco Systems
Question Title: C Algorithm
Language: C
QUESTION DETAILS:

What will be the output of the following printf statement? And what will be the output in case of a union?
#include<stdio.h>
struct xx {
char a;
int b;
};
main(){
int r=sizeof(struct xx);
printf("%d", r);
}


In case of struct:
Output will be: 8

In case of union:
Output will be: 4

(For 32-bit system)
All Questions