...
Question 11544 – APPSC-2012-DL-CS
May 31, 2024
Question 10160 – Computer-Organization
May 31, 2024
Question 11544 – APPSC-2012-DL-CS
May 31, 2024
Question 10160 – Computer-Organization
May 31, 2024

Question 8945 – ISRO CS 2020

What is the output in a 32 bit machine with 32 bit compiler?
#include
rer(int **ptr2, int **ptr1)
{
int* ii;
ii=*ptr2;
*ptr2=*ptr1;
*ptr1=ii;
**ptr1*=**ptr2;
**ptr2+=**ptr1;
}
void main()
{
int var1=5, var2=10;
int *ptr1=&var1, *ptr2=&var2;
rer(&ptr1, &ptr2);
printf(“%d %d”, var2, var1);
}

Correct Answer: D

Question 74 Explanation: 
Address of var1 and var2 passed to the function.
rer(int **ptr2, int **ptr1) // ptr2 will point to var1 and ptr1 will point to var2
{
int* ii;
ii=*ptr2; // value 5 will store memory location which is pointed by pointer “ii”
*ptr2=*ptr1; // value 10 will store memory location which is pointed by pointer “ptr2”
*ptr1=ii; // pointer will point to “ii” which means that ptr1 will point to 5
**ptr1*=**ptr2; //**ptr1 =**ptr1* **ptr2 =5*10 =50
**ptr2+=**ptr1; // **ptr2=**ptr2+ **ptr1 =10+50 =60
}
Var1 value modified into 50 and var2 value modified into 60
A
60 70
B
50 50
C
50 60
D
60 50
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!