main()
{
int i = 257;
int *iPtr = &i;
printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) );
}
Answer / susie
Answer :
1 1
Explanation:
The integer value 257 is stored in the memory as, 00000001
00000001, so the individual bytes are taken by casting it to
char * and get printed.
| Is This Answer Correct ? | 16 Yes | 1 No |
Give a oneline C expression to test whether a number is a power of 2?
25 Answers EA Electronic Arts, Google, Motorola,
write a program to find out roots of quadratic equation "x=-b+-(b^2-4ac0^-1/2/2a"
main() { float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); }
struct Foo { char *pName; char *pAddress; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); obj->pName = malloc(100); obj->pAddress = malloc(100); strcpy(obj->pName,"Your Name"); strcpy(obj->pAddress, "Your Address"); free(obj); printf("%s", obj->pName); printf("%s", obj->pAddress); } a. Your Name, Your Address b. Your Address, Your Address c. Your Name Your Name d. None of the above
main() { extern out; printf("%d", out); } int out=100;
main() { char string[]="Hello World"; display(string); } void display(char *string) { printf("%s",string); }
main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }
find A^B using Recursive function
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().
void main() { int x,y=2,z; z=(z*=2)+(x=y=z); printf("%d",z); }
main() { char name[10],s[12]; scanf(" \"%[^\"]\"",s); } How scanf will execute?
main() { char a[4]="HELL"; printf("%s",a); }