10.
How can we check whether the contents of two structure variables are same or not?
Ans:
There is no way to compare entire structure, we can only compare element by element.
example:
typedef struct{
int a;
int b;
} ravi_t;
main()
{
ravi_t r;
ravi_t s;
/* this is not allowed */
if(r==s) /* this is not allowed */;
/* where as we can compare element by element */
if(r.a == s.a);
|