int a = 10 + 10
....
,...
A = A * A
What would be the value of A?
The answer is 120!! Could anyone explain this to me.
Answers were Sorted based on User's Feedback
Answer / vinayak bhat
a=10*10
It s a macro concept,,very simple
a=a*a becomes
a=10+10*10+10
* has highest priority than +
hence expression becomes like
a=10+(10*10)+10
a=10+100+10
a=120
Is This Answer Correct ? | 24 Yes | 6 No |
Answer / nagarajanselvaraj
In C everything is case sensitive
so variable with name 'a' differs from variable
with name 'A'
The given result is not possible
because 120 is not a square number.
Is This Answer Correct ? | 21 Yes | 4 No |
What are segment and offset addresses?
void main() { char a[]="12345\0"; int i=strlen(a); printf("here in 3 %d\n",++i); }
Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without making use of any floating point computations at all.
2 Answers Mentor Graphics, Microsoft,
Is this code legal? int *ptr; ptr = (int *) 0x400;
main(){ char a[100]; a[0]='a';a[1]]='b';a[2]='c';a[4]='d'; abc(a); } abc(char a[]){ a++; printf("%c",*a); a++; printf("%c",*a); }
Program to find the largest sum of contiguous integers in the array. O(n)
Write a program to check whether the number is prime and also check if it there i n fibonacci series, then return true otherwise return false
main() { int i = 3; for (;i++=0;) printf(“%d”,i); }
main() { int i=3; switch(i) { default:printf("zero"); case 1: printf("one"); break; case 2:printf("two"); break; case 3: printf("three"); break; } }
main() { unsigned char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
const int perplexed = 2; #define perplexed 3 main() { #ifdef perplexed #undef perplexed #define perplexed 4 #endif printf("%d",perplexed); } a. 0 b. 2 c. 4 d. none of the above
main() { extern int i; i=20; printf("%d",i); }