What is the difference between short int and int?
1. Find output for following recursive function :int main(){int i=32242,j=find(i);}int find(int j){if(j){j = j%10 + find(j/10);printf(" %d ",j);}return j;} 2. What is the problem with following code : char* addnewlinetostring(char *s){char buffer[1024];strcpy(buffer,s);buffer[strlen(s)-1] = 'n';return...
The answer is 3 5 7 11 13
1.The answer is:24223
What is the answer of a++ + ++a + a++ int a=5;c = a++ + ++a + a++;//compiler produces the answer 28!!!//how
Which operation in the following expression will be performed first?
c = a++ / b + 5;
c = a++ + ++a + ++a Compiler starts from leftmost operand
Code
1+5 = 6 a = 6 1+6 =7 a = 6+7 a =13 1+13 =14 Now c = 6+ ++7 ++13 c = 28
The general idea is that short "always" represents a 16-bit integer, whereas int represents whatever the native word size is for that particular architecture (16- or 32-bit). "Always" is in scare quo...
Sorry to say that actually in most of C compiler short int is also of 16 bit and they are equivalent to each other.