#include <iostream>


int main() {

  int num = 5;

  float fnum = 3.14;

  char c = 'A';


  // Declare a void pointer

  void *ptr;


  // Assign the address of num to the void pointer

  ptr = &num;

  std::cout << "The value stored at the address stored in ptr is " << *(int*)ptr << std::endl;


  // Assign the address of fnum to the void pointer

  ptr = &fnum;

  std::cout << "The value stored at the address stored in ptr is " << *(float*)ptr << std::endl;


  // Assign the address of c to the void pointer

  ptr = &c;

  std::cout << "The value stored at the address stored in ptr is " << *(char*)ptr << std::endl;


  return 0;

}

output:

The value stored at the address stored in ptr is 5
The value stored at the address stored in ptr is 3.14
The value stored at the address stored in ptr is A