Ways to declare Pointers - Devbhoomi

FREE JOB ALERT & ONLINE TUTORIALS

Hot

Post Top Ad

Sunday 5 November 2017

Ways to declare Pointers



    int *i;
    char *ch;
    float *f;

  • Here, ich and f are declared as pointer variables, i.e.variables capable of holding addresses.
  • Remember that, addresses are always going to be whole numbers, therefore pointers always contain whole numbers.
  • Now we can put these two facts together and say that the pointers are variables that contain addresses, and since addresses are always whole numbers, pointers would always contain whole numbers.
  • The declaration float *f does not mean that f is going to contain a floating-point value. What it means is, f is going to contain the address of a floating-point value.
  • Similarly, char *ch means that ch is going to contain the address of a char value.

No comments:

Post a Comment

Post Top Ad