suma_ranga
Newbie level 5
hi all,
i have a doubt in the following c code..the output of the code is 20 and 276... can anyone explain y this is so. what is happening in each step. y (int)n = 276 instead of 256..
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int n = 256;
int *p = &n;
char *pp = (char*)p;
*pp = 20;
pp= printf("%d", (int)*pp);
n =printf("%d", (int)n);
system("PAUSE");
return 0;
}
i have a doubt in the following c code..the output of the code is 20 and 276... can anyone explain y this is so. what is happening in each step. y (int)n = 276 instead of 256..
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int n = 256;
int *p = &n;
char *pp = (char*)p;
*pp = 20;
pp= printf("%d", (int)*pp);
n =printf("%d", (int)n);
system("PAUSE");
return 0;
}