Which lines of code contain mistakes:

int main()
{
  int intvar;
  float flovar;
  int* intptr;
  float* floptr;
  void * voidptr;

  intptr=&intvar ; //1
  intptr=&flovar ; //2
  floptr =& intvar ;//3
  floptr =&flovar;  //4
  voidptr =& intvar; //5
  voidptr =&flovar ; //6
}
Explanation
A pointer is associated with a type (of the value it points to), which is specified during declaration. A pointer can only hold an address of the declared type; it cannot hold an address of a different type.
However, a void pointer can hold address of any data type (except function pointer).
Source: Pointer has a Type Too

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback