C puzzle: Output of printf should be '5' always
Posted
by pragadheesh
on Stack Overflow
See other posts from Stack Overflow
or by pragadheesh
Published on 2010-02-02T05:40:28Z
Indexed on
2010/03/28
10:53 UTC
Read the original article
Hit count: 302
Hi,
I found this puzzle in a C aptitude paper.
void change()
{
//write something in this function so that output of printf in main function
//should always give 5.you can't change the main function
}
int main()
{
int i = 5;
change();
i = 10;
printf("%d", i);
return 0;
}
Any solutions.?
© Stack Overflow or respective owner