Allora, you don't mix Italian and C, it's so unelegant!
So let's see, the problem is that comparison has precedence over assignment (
http://www.swansontec.com/sopc.html), so what this line is doing?
Code:
fp = fopen("test", "w") == NULL
It first evaluates the comparison between fopen's return value and NULL, which yields an integer (1 or 0 arguably), then it says:
And that's your warning, il tuo puntatore è sminchio a bestia it means!
That's the int being coerced into a pointer... try to read from fp and you should experience a beautiful crash! Mamma mia!!
Use parentheses to set the correct precedence:
Code:
if ((fp = fopen("test", "w")) == NULL) {