edited by
818 views

4 Answers

1 votes
1 votes
int main() {
 int a=10;            // value of a =10;
 int *b=&a;          // pointer b stores the address of a i.e. points to a
 scanf("%d",b);     // b gets a value from user(25) and stores it in a since b points to a
 printf("%d",a+50);  // here a = (value which user gave + 50)= 25+50 = 75
 return 0;
}

$\therefore$ here value of $a$ = (value which user gave + 50) = 25+50 = $75$ will be printed as output.

0 votes
0 votes
Here the answer will be 75 because here you are putting the address of a in scanf. so, when scanf is called it will read the input value to the memory location a. so, in a instead of 10 25 will be stored and when 25 is added to 50 we will get answer as 75 which is printed as given in the code.

Related questions

3 votes
3 votes
1 answer
1
Storm_907 asked Apr 16, 2023
461 views
Please explain this question void main() { int a =300; char *ptr = (char*) &a ; ptr++; *ptr=2; printf("%d" , a); }
0 votes
0 votes
0 answers
4