Explanation of guess the output questions posted on our Instagram Page.
1) Guess the output

The output of above C Program is D) 3 -2.
Why?
Initially the values of m and n are 5 and 3 respectively.
For your information: a += b
is same as a = a+b
a -= b
is same as a = a-b
a *= b
is same as a = a*b
a /= b
is same as a = a/b
a %= b
is same as a = a%b
and so on…
The above expression m += n -= m
acts like m = m + (n = n-m);
First of all, bracket will execute so the value of n becomes n = n - m
i.e. n = 3 - 5
. n = -2
The updated expression looks likem = m + (-2)
Final value of m is m = 5 - 2
which is equal to 3.
So the output of above C Program is 3 -2
.
Click on Execute button to Run above code:
2) Question On Array

We know that 1[arr] is same as arr[1]. Initially arr[2] is filled with garbage values.
Then 5 is assigned to arr[0] and 10 is assigned to arr[1].
printf(“%d”, -1[arr]) is nothing but printf(“%d”, – arr[1]). The value at arr[1] is 10.
So the output of above C Program is -10.
Click on Execute button to Run above code:
3) Type Casting

The output of above C Program is B) 49.
ASCII equivalent of the character will be displayed in conversion of char to int in C/C++ Programming Language.
The ASCII value of 0 is 48, 1 is 49 and so on.
You can print ASCII values and equivalent character using C or C++ Language.
//Program to Print ASCII Value and its equivalent character
#include<stdio.h>
int main() {
int i;
for(i=48; i<100; i++)
{
printf("%d : %c \n", i, i);
}
return 0;
}
Click on Execute button to Run above code:
For more programming related questions and fun,
Follow us on Instagram.
https://www.instagram.com/computer_science_engineering_/