#include <stdio.h>
int out(int n, char *buffer) {
if (n=(int)NULL) {
return puts(buffer);
}
if (n=1) {
return fputs(buffer,st dout);
}
if(n!=1||n!=(in t)NULL) {
fprintf(stderr, "Usage error\n");
return 0;
}
}
The above code before I added the int casts just by a gut feeling didn't
work. By adding the int casts in front of the NULLs what have I really done?
I hope the wrote the right thing. The code before the int casts compiled
into an object file but the compiler through bash's stderr gave me warnings
that I needed casts. Have I corrected a portability problem. It's not good
to guess things even if it's right but to know what you did.
Bill
int out(int n, char *buffer) {
if (n=(int)NULL) {
return puts(buffer);
}
if (n=1) {
return fputs(buffer,st dout);
}
if(n!=1||n!=(in t)NULL) {
fprintf(stderr, "Usage error\n");
return 0;
}
}
The above code before I added the int casts just by a gut feeling didn't
work. By adding the int casts in front of the NULLs what have I really done?
I hope the wrote the right thing. The code before the int casts compiled
into an object file but the compiler through bash's stderr gave me warnings
that I needed casts. Have I corrected a portability problem. It's not good
to guess things even if it's right but to know what you did.
Bill
Comment