2 Added a photo
source | link

I shall assume someone going to learn pointers knows what the normal variables are and how they work in C. Now, let's try to define pointers with some of it's attributes-

  • They are also variables, but of different nature. Assume there are two layers in the variable space. The normal variables of different types resides in the upper layer and pointers in the lower layer.

    They are also variables, but of different nature. Assume there are two layers in the variable space. The normal variables of different types resides in the upper layer and pointers in the lower layer. Like this figure-

    alt text

  • As the name 'Pointer' suggests, pointers can POINT to something. Like our finger can point to some object. What are the things they point to? These are the normal variables. In short, "Pointers point to normal variables".

    As the name 'Pointer' suggests, pointers can POINT to something. Like our finger can point to some object. What are the things they point to? These are the normal variables. In short, "Pointers point to normal variables".

  • Like normal variables, pointers also are of same number of types like int,char or float. And a pointer of a specific type can point to only same type of variables.
  • A pointer can point to one variable and later the same pointer can point to another variable. Just the type should be same. So, the a pointer's association with some variable is not permanent and can be changed.
  • So, how a pointer is declared? Almost like normal variables. You have to precede the name with an asterisk(*). Like-

    int *pointer;
    
  • Then, how a pointer is associated with a variable? Using the & operator before the variable like this statement-

    pointer = &variable;
    
  • How a pointer is used by pointing to a variable? This is also done by preceding the name with an asterisk(*). Then it can be used in the place of the variable it's pointing now-

    *pointer = var1 + var2;
    

    instead of

    variable = var1 + var2;
    
  • Now, play with pointers with some code. Just get used to this characteristics of pointers now. Upto this point, we are talking about what pointers do. Once you are ok with it, then start studying how pointers are pointing to some variable and how they react if normal arithmetic operations are applied on them. Then go for the relation between pointers and arrays and pointers to pointers.

That is all I canshall suggest about learning pointers.

I shall assume someone going to learn pointers knows what the normal variables are and how they work in C. Now, let's try to define pointers with some of it's attributes-

  • They are also variables, but of different nature. Assume there are two layers in the variable space. The normal variables of different types resides in the upper layer and pointers in the lower layer.
  • As the name 'Pointer' suggests, pointers can POINT to something. Like our finger can point to some object. What are the things they point to? These are the normal variables. In short, "Pointers point to normal variables".
  • Like normal variables, pointers also are of same number of types like int,char or float. And a pointer of a specific type can point to only same type of variables.
  • A pointer can point to one variable and later the same pointer can point to another variable. Just the type should be same. So, the a pointer's association with some variable is not permanent and can be changed.
  • So, how a pointer is declared? Almost like normal variables. You have to precede the name with an asterisk(*). Like-

    int *pointer;
    
  • Then, how a pointer is associated with a variable? Using the & operator before the variable like this statement-

    pointer = &variable;
    
  • How a pointer is used by pointing to a variable? This is also done by preceding the name with an asterisk(*). Then it can be used in the place of the variable it's pointing now-

    *pointer = var1 + var2;
    

    instead of

    variable = var1 + var2;
    
  • Now, play with pointers with some code. Just get used to this characteristics of pointers now. Upto this point, we are talking about what pointers do. Once you are ok with it, then start studying how pointers are pointing to some variable and how they react if normal arithmetic operations are applied on them. Then go for the relation between pointers and arrays and pointers to pointers.

That is all I can suggest about pointers.

I shall assume someone going to learn pointers knows what the normal variables are and how they work in C. Now, let's try to define pointers with some of it's attributes-

  • They are also variables, but of different nature. Assume there are two layers in the variable space. The normal variables of different types resides in the upper layer and pointers in the lower layer. Like this figure-

    alt text

  • As the name 'Pointer' suggests, pointers can POINT to something. Like our finger can point to some object. What are the things they point to? These are the normal variables. In short, "Pointers point to normal variables".

  • Like normal variables, pointers also are of same number of types like int,char or float. And a pointer of a specific type can point to only same type of variables.
  • A pointer can point to one variable and later the same pointer can point to another variable. Just the type should be same. So, the a pointer's association with some variable is not permanent and can be changed.
  • So, how a pointer is declared? Almost like normal variables. You have to precede the name with an asterisk(*). Like-

    int *pointer;
    
  • Then, how a pointer is associated with a variable? Using the & operator before the variable like this statement-

    pointer = &variable;
    
  • How a pointer is used by pointing to a variable? This is also done by preceding the name with an asterisk(*). Then it can be used in the place of the variable it's pointing now-

    *pointer = var1 + var2;
    

    instead of

    variable = var1 + var2;
    
  • Now, play with pointers with some code. Just get used to this characteristics of pointers now. Upto this point, we are talking about what pointers do. Once you are ok with it, then start studying how pointers are pointing to some variable and how they react if normal arithmetic operations are applied on them. Then go for the relation between pointers and arrays and pointers to pointers.

That is all I shall suggest about learning pointers.

1
source | link

I shall assume someone going to learn pointers knows what the normal variables are and how they work in C. Now, let's try to define pointers with some of it's attributes-

  • They are also variables, but of different nature. Assume there are two layers in the variable space. The normal variables of different types resides in the upper layer and pointers in the lower layer.
  • As the name 'Pointer' suggests, pointers can POINT to something. Like our finger can point to some object. What are the things they point to? These are the normal variables. In short, "Pointers point to normal variables".
  • Like normal variables, pointers also are of same number of types like int,char or float. And a pointer of a specific type can point to only same type of variables.
  • A pointer can point to one variable and later the same pointer can point to another variable. Just the type should be same. So, the a pointer's association with some variable is not permanent and can be changed.
  • So, how a pointer is declared? Almost like normal variables. You have to precede the name with an asterisk(*). Like-

    int *pointer;
    
  • Then, how a pointer is associated with a variable? Using the & operator before the variable like this statement-

    pointer = &variable;
    
  • How a pointer is used by pointing to a variable? This is also done by preceding the name with an asterisk(*). Then it can be used in the place of the variable it's pointing now-

    *pointer = var1 + var2;
    

    instead of

    variable = var1 + var2;
    
  • Now, play with pointers with some code. Just get used to this characteristics of pointers now. Upto this point, we are talking about what pointers do. Once you are ok with it, then start studying how pointers are pointing to some variable and how they react if normal arithmetic operations are applied on them. Then go for the relation between pointers and arrays and pointers to pointers.

That is all I can suggest about pointers.