Reputation:
this is my code.
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int a, b, somma, massimo;
printf("Inserire il primo valore: A =");
scanf_s("%d", a);
printf("Inserire il secondo valore: B =");
scanf_s("%d", b);
if (b > 0) { //1
printf("B = %d e positivo", b);
} else {
printf("B = %d e negativo", b);
}
if (a % 2 == 0){ //2
printf("A = %d e pari", a);
} else {
printf("A = %d e dispari", a);
}
somma = a + b; //3
printf("A + B = %d", somma);
if (a < 0) { //4
a = -a;
}
if (b < 0) {
b = -b;
}
massimo = a + b;
printf("Il numero più grande ottenibile con questi due numeri A, B e %d", massimo);
}
when i try to compile it gives me this warning:
1>c:\users\mario\documents\visual studio 2015\projects\controlla a e b\main.c : error C4335: Mac file format detected: please convert the source file to either DOS or UNIX format
1>c:\users\mario\documents\visual studio 2015\projects\controlla a e b\main.c(1): warning C4067: unexpected tokens following preprocessor directive - expected a newline
Upvotes: 3
Views: 23577
Reputation: 454
Along with the wrong encoding type, this warning can also generate with incorrect end of line sequence. So try changing the same.
In VSCode, on the bottom-right click on CRLF (or LF depending on the default setting). A popup will appear; choose the required sequence.
Upvotes: 0
Reputation: 11
I found that this error can appear due to a poorly constructed #define, such as:
#define USE_THIS true;
...
#if USE_THIS
<some code>
#endif
Obviously you don't use the semicolon.
This is not exactly relevant to the above example, but I included it here just in case someone searches for this error message.
Upvotes: 1