No products in the cart.

Find output C++ ? Explaination

CBSE, JEE, NEET, CUET

CBSE, JEE, NEET, CUET

Question Bank, Mock Tests, Exam Papers

NCERT Solutions, Sample Papers, Notes, Videos

Find output C++ ? Explaination
  • 1 answers

Sia ? 5 years, 2 months ago

<pre> #include<iostream> #include<stdlib.h> using namespace std; int main() { float x=5.999; float *y,*z; y=&x; z=y; cout<<x<<","<<*(&x)<<","<<*y<<","<<*z<<"\n"; return 0; } </pre>

Output

<pre> 5.999,5.999,5.999,5.999 </pre>

Explanation
The reason for this is x gives the value stored in the variable x. *(&x) gives the data value stored in the address &x i.e., the data value of x. Since y points to x (..y=&x), *y gives the value of x. And because z has the same address as that of y, *z also gives the value of x i.e., 5.999.

http://mycbseguide.com/examin8/

Related Questions

What is mean by buffering in file handling?
  • 1 answers
What are called tokens
  • 2 answers

myCBSEguide App

myCBSEguide

Trusted by 1 Crore+ Students

Test Generator

Test Generator

Create papers online. It's FREE.

CUET Mock Tests

CUET Mock Tests

75,000+ questions to practice only on myCBSEguide app

Download myCBSEguide App