Float value pointer and int value pointer : Float « Data Type « C++






Float value pointer and int value pointer

Float value pointer and int value pointer
 
#include <iostream>
using namespace std;

int main()
{
  float *f;
  int *i;

  f = new float;
  i = new int;

  if(!f || !i) {
    cout << "Allocation error\n";
    return 1;
  }

  *f = 10.101;
  *i = 100;

  cout << *f << ' ' << *i << '\n';

  delete f;
  delete i;

  return 0;
}



           
         
  








Related examples in the same category

1.10.0 would be interpreted as floating point10.0 would be interpreted as floating point
2.Make the result of integer division a floatMake the result of integer division a float
3.Enter hexadecimal digits and a floating-point numberEnter hexadecimal digits and a floating-point number
4.cin to read float in C++cin to read float in C++
5.Demonstrates the definition and use of references.Demonstrates the definition and use of references.
6.Return float type from function
7.Get the square and cube of a float type number