+ 12

What happens if we compare an int with char ?? Explain the following program.

#include<stdio.h> int main() { unsigned int i = 23; signed char c = -23; if (i>c) printf("yes\n"); else if(i<c) printf("No\n"); printf("%d",i+c); } Output : No 0

7th Jun 2019, 3:38 AM
Manoj
Manoj - avatar
3 Answers
+ 1
The char may get converted to an unsigned int and become 233.
7th Jun 2019, 3:54 AM
Vlad Serbu
Vlad Serbu - avatar
0
You char is still a number
7th Jun 2019, 3:51 AM
Lexfuturorum
Lexfuturorum - avatar