Consider a hypothetical machine which supports the following data types:
unsigned char :1 Byte
unsigned short : 2 Bytes
int :4 Bytes
Consider the following function red()
int red (unsigned char a, unsigned short b)
{
if (a==0) return b;
else
{
a=a+1;
b=b*2;
return red(a,b);}
}
int main(){
printf("%d",red(char(240),1));
return 0;
}
What will be the output of the following program?
A The program terminates abnormally
B The program goes into infinite loop
C The program outputs 65536 (216)
D None of these
Answer is given as D.
That is fine but my question is that what will be the output of the program.
Because according to me it should be 32768, but in madeeasy solution it is given as output 0.