wiz-icon
MyQuestionIcon
MyQuestionIcon
2
You visited us 2 times! Enjoying our articles? Unlock Full Access!
Question

What will be the output of the following piece of code when executed?
#include<iostream.h>
voidf(int*iptr)
{
*iptr=1;
}
main()
{
int i=0;
f(&i);
cout<<"The value is"<<i<<ends];
return 0;
}

A
The value is 0
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
B
The value is 1
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
will generate compiler error
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
The value can not be specified i.e. it will contain garbage.
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is A The value is 0

The output of the following piece of code when executed will be:-
#include<iostream.h>
voidf(int*iptr)
{
*iptr=1;
}
main()
{
int i=0;
f(&i);
cout<<"The value is"<<i<<ends];
return 0;
}

Output:-

0.



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