CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

What does the following program print ?

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

A
2, 2
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
0, 2
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
C
2, 1
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
0, 1
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is B 0, 2
option (d)



Step 1: initially 'p' has address of 'i' and 'q' has address of 'j'Step 2: p =q means Content of 'p' is updated with content of 'q' i.e. phas address of 'j'Step 3: *p=2; means content of 'j is updated with 2Step 4: The output is 0, 2

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Difference of Two Sets
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon