- Joined
- Jan 13, 2016
- Messages
- 971
- Reaction score
- 347
- Trophies
- 0
- Age
- 57
- Location
- That Chaos Site
- XP
- 529
- Country



#include <stdio.h>
int main() {
int a = 2;
char b = 'b';
printf("%i", a + b);
return 0;
}
#include <stdio.h>
int main() {
int a = 2;
char b = 'b';
printf("%i", a + (int)b);
return 0;
}

ah ok thnxThe compiler basically adds the casts for you when needed. The following program:
Code:#include <stdio.h> int main() { int a = 2; char b = 'b'; printf("%i", a + b); return 0; }
will compile into the exact same executable when the cast is explicit:
Code:#include <stdio.h> int main() { int a = 2; char b = 'b'; printf("%i", a + (int)b); return 0; }