Q. | What will be output if you will execute following code? #include
union address{
char *name;
char street[10];
int pin;
};
int main(){
union address emp,*p;
emp.name="sh\0alu";
p=&emp;
printf("%s%s",p->name,(*p).name);
return 0;
}
|
|||||||
|
Answer: | Option D | |
Explaination: | p is pointer to union address. -> and (*). Both are same thing. These operators are used to access data member of union by using union's pointer.%s is used to print the string up to null character i.e. '\0'. |
Discussion
Your Comments Goes here... |
Name | Discussion |
---|