Database-Management-System
October 17, 2023STQC-NIELIT STA 2021
October 17, 2023GATE 2017 [Set-2]
Question 14
|
Consider the following function implemented in C:
void printxy (int x, int y) { int *ptr; x = 0; ptr = &x; y = *ptr; *ptr = 1; printf("%d,%d",x,y); }
The output of invoking printxy(1, 1) is
0, 0
|
|
0, 1
|
|
1, 0
|
|
1, 1
|
Question 14 Explanation:
printxy (int x, int y)
{
int *ptr;
x = 0;
ptr = &x;
y = *ptr;
*ptr = 1;
![](https://solutionsadda.in/wp-content/uploads/2019/12/d11-2.jpg)
}
printxy (1, 1)
{
int *ptr;
x = 0;
ptr = &x;
y = *ptr;
*ptr = 1;
![](https://solutionsadda.in/wp-content/uploads/2019/12/d11-2.jpg)
}
printxy (1, 1)
![](https://solutionsadda.in/wp-content/uploads/2019/12/r1-2.jpg)
Correct Answer: C
Question 14 Explanation:
printxy (int x, int y)
{
int *ptr;
x = 0;
ptr = &x;
y = *ptr;
*ptr = 1;
![](https://solutionsadda.in/wp-content/uploads/2019/12/d11-2.jpg)
}
printxy (1, 1)
{
int *ptr;
x = 0;
ptr = &x;
y = *ptr;
*ptr = 1;
![](https://solutionsadda.in/wp-content/uploads/2019/12/d11-2.jpg)
}
printxy (1, 1)
![](https://solutionsadda.in/wp-content/uploads/2019/12/r1-2.jpg)
Subscribe
Login
0 Comments