Hi All,
When I execute the below code Im getting the value of a as 5 and y as 10. can anyone please explain why the value of y is printed as 10.
Code:void main() { int a=3,y; y= ++a + ++a; printf("a %d y %d",a,y); } o/p: a 5 y 10
Hi All,
When I execute the below code Im getting the value of a as 5 and y as 10. can anyone please explain why the value of y is printed as 10.
Code:void main() { int a=3,y; y= ++a + ++a; printf("a %d y %d",a,y); } o/p: a 5 y 10
Read: C FAQ on Expressions
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
And don't use "void main()" - FAQ > main() / void main() / int main() / int main(void) / int main(int argc, char *argv[]) - Cprogramming.com