+ 2
Why the return statement only take integer ,why it can't take char as char has also a ascii value which is also a integer.
2 odpowiedzi
+ 2
Or you can convert the char to int:
int bla() {
char a = 'a';
return (int)a;
}
+ 1
If you could mix it all up with no consequences, why would you have types in the first place?
With a char, the stored integer will be interpreted as a letter.
If you want to return a char, you can just make the return value char:
char myfunc(int) {...}