main()
{
char *p1=“name”;
char *p2;
p2=(char*)malloc(20);
memset (p2, 0, 20);
while(*p2++ = *p1++);
printf(“%sn”,p2);
{
char *p1=“name”;
char *p2;
p2=(char*)malloc(20);
memset (p2, 0, 20);
while(*p2++ = *p1++);
printf(“%sn”,p2);
}
Answer:empty string.
main()
{
int x=20,y=35;
x=y++ + x++;
y= ++y + ++x;
printf(“%d%dn”,x,y);}
Answer : 5794
main()
{
int x=5;
printf(“%d,%d,%dn”,x,x< <2,x>>2);}
Answer: 5,20,1
#define swap(a,b) a=a+b;b=a-b;a=a-b;void main()
{
int x=5, y=10;
swap (x,y);
printf(“%d %dn”,x,y);
swap2(x,y);
printf(“%d %dn”,x,y);
}int swap2(int a, int b)
{
int temp;
temp=a;
b=a;
a=temp;
return 0;}
Answer: 10, 5
10, 5
10, 5
No comments:
Post a Comment