main()
{
int i=300;
char *ptr = &i;
*++ptr=2;
printf("%d",i);
}
Answers were Sorted based on User's Feedback
Answer / susie
Answer :
556
Explanation:
The integer value 300 in binary notation is: 00000001
00101100. It is stored in memory (small-endian) as:
00101100 00000001. Result of the expression *++ptr = 2 makes
the memory representation as: 00101100 00000010. So the
integer corresponding to it is 00000010 00101100 => 556.
| Is This Answer Correct ? | 77 Yes | 8 No |
Answer / bidhu
I think the answer depends on compiler.
In Dev-C++ the result is cannot convert int* to char* error
In Code:Block it gives a warning but gives the result 556
| Is This Answer Correct ? | 1 Yes | 3 No |
main() { int i = 100; clrscr(); printf("%d", sizeof(sizeof(i))); } a. 2 b. 100 c. 4 d. none of the above
write a c-program to find gcd using recursive functions
write a c-program to display the time using FOR loop
what is variable length argument list?
void main() { char a[]="12345\0"; int i=strlen(a); printf("here in 3 %d\n",++i); }
main() { int i=-1; -i; printf("i = %d, -i = %d \n",i,-i); }
How to swap two variables, without using third variable ?
104 Answers AB, ADP, BirlaSoft, Cisco, Cygnet Infotech, HCL, Hewitt, Honeywell, HP, IBM, Infosys, Manhattan, Microsoft, Mobius, Percept, Satyam, SofTMware, TCS, Wipro, Yamaha,
main() { int i = 258; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) ); }
int i,j; for(i=0;i<=10;i++) { j+=5; assert(i<5); }
void main() { char ch; for(ch=0;ch<=127;ch++) printf(ā%c %d \nā, ch, ch); }
Give a oneline C expression to test whether a number is a power of 2?
25 Answers EA Electronic Arts, Google, Motorola,
int main() { int x=10; printf("x=%d, count of earlier print=%d", x,printf("x=%d, y=%d",x,--x)); getch(); } ================================================== returns error>> ld returned 1 exit status =================================================== Does it have something to do with printf() inside another printf().