0
Why s1=!s2 ??
#include<stdio.h> int main() { typedef struct { char ch; } st; st s1 = {'c'}; st s2 = s1; if(s1 == s2) printf("Successful"); return 0; // output Compile error
3 Respuestas
+ 3
You cannot compare the struct, that is you can't apply the following:
==, !=, <, <=, >, >=.
The best you can do is compare the member. In your case it could be if(s1.ch == s2. ch).
+ 2
You are not supposed to compare the structs. You have to compare the values. So it should be:
s1.ch == s2.ch
0
Infinity CarrieForle yes now I got it. Thanks.