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() { float i=1.5; switch(i) { case 1: printf("1"); case 2: printf("2"); default : printf("0"); } }
#include<conio.h> main() { int x,y=2,z,a; if(x=y%2) z=2; a=2; printf("%d %d ",z,x); }
main() { char *p="hai friends",*p1; p1=p; while(*p!='\0') ++*p++; printf("%s %s",p,p1); }
#include <stdio.h> main() { char * str = "hello"; char * ptr = str; char least = 127; while (*ptr++) least = (*ptr<least ) ?*ptr :least; printf("%d",least); }
char *someFun() { char *temp = “string constant"; return temp; } int main() { puts(someFun()); }
main() { char *p; p="Hello"; printf("%c\n",*&*p); }
Who could write how to find a prime number in dynamic array?
Write a program that reads a dynamic array of 40 integers and displays only even integers
Under linux environment can u please provide a c code for computing sum of series 1-2+3-4+5......n terms and -1+2-3+4-5...n terms..
struct point { int x; int y; }; struct point origin,*pp; main() { pp=&origin; printf("origin is(%d%d)\n",(*pp).x,(*pp).y); printf("origin is (%d%d)\n",pp->x,pp->y); }
why the range of an unsigned integer is double almost than the signed integer.
How to return multiple values from a function?