Pointers in C:
This is available only in C language. Pointer points to the address of any variable, dynamic in nature and used in memory allocation purpose.
Also, it is better to assign null value to a ptr as their is garbage value.
Syntax: type *var_name;
Example 1:
//program to show pointer in C
#include<stdio.h>
int main ( )
{
int var = 20;
int *ip;
ip = &var;
printf ("address: %x\n",&var);
printf ("address stored in ip variable: %d \n",*ip);
return 0;
}
Example 2:
Comments
Post a Comment
if you have any doubts, pls let me know