Thursday, February 14, 2008

Aptitude Question No.2

Aptitude Question No.2

main()
{
char *p;
p="Hello";
printf("%c\n",*&*p);
}
Answer
H

Explanation
* is a dereference operator & is a reference operator. They can be applied any number of times provided it is meaningful. Here p points to the first character in the string "Hello". *p dereferences it & so its value is H. Again & references it to an address & * dereferences it to the value H.

No comments:

2008 Placement papers of Top MNC companies

eXTReMe Tracker