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 = 0xff ; printf("\n%d", i<<2); } a. 4 b. 512 c. 1020 d. 1024
main() { int a[10]; printf("%d",*a+1-*a+3); }
How can you relate the function with the structure? Explain with an appropriate example.
can u give me the c codings for converting a string into the hexa decimal form......
how can u draw a rectangle in C
53 Answers Accenture, CO, Codeblocks, Cognizant, HCL, Oracle, Punjab National Bank, SAP Labs, TCS, University, Wipro,
Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary.
main() { int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }
What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?
void main() { static int i=5; if(--i){ main(); printf("%d ",i); } }
#define DIM( array, type) sizeof(array)/sizeof(type) main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr, int)); }
main() { int i=-1; +i; printf("i = %d, +i = %d \n",i,+i); }
main() { 41printf("%p",main); }8