Question 14380 – DSSSB PGT 2018 Female
February 5, 2024
NTA UGC NET Dec 2023 Paper-2
February 6, 2024
Question 14380 – DSSSB PGT 2018 Female
February 5, 2024
NTA UGC NET Dec 2023 Paper-2
February 6, 2024

Question 9025 – GATE 2010

What does the following program print?

#include
void f(int *p, int *q)
{
  p = q;
 *p = 2;
}
int i = 0, j = 1;
int main()
{
  f(&i, &j);
  printf("%d %d n", i, j);
  getchar();
  return 0;
}

Correct Answer: D

Question 11 Explanation: 

Both pointers points to j = 1
now *p = 2
where j is updated with value 2.
printf (i, j) i = 0, j = 2
A
2 2
B
2 1
C
0 1
D
0 2

Leave a Reply

Your email address will not be published. Required fields are marked *