AD1

Wednesday, 1 March 2017

what is the output of this C code

#include <stdio.h>
struct point
{
int x;
int y;
};
struct notpoint
{
int x;
int y;
};
int main()
{
struct point p1={10,20};
struct point p2={-10,-20};
p1=p2;
printf("%d\t%d",p1.x,p1.y);
struct notpoint p3={100,200};
p3=p1;
printf("%d\t%d",p3.x,p3.y);
if(p3>p2)
{
printf("hello\n");
}
else
{
printf("C programming\n");
}
return 0;
}
view raw s.c hosted with ❤ by GitHub
output :
compilation error in line 19 , as you can not assign two structures of different types
also there is a compilation error in line 21 as rational operators can not be applied on structures

No comments:

Post a Comment