What are pointers? How do we use pointers to different data types?


==> POINTERS--

  • A pointer is a variable which contains the address in memory of another variable.
  • Pointers are the variables that are used to store the location of value present in the memory

       Declaration :

                             data_type *variable_name;

                              Ex : int *a;

                  Ex :

                         #include int main()

                         {

                            int var = 20;

                            int *ip;

                            ip=&var;

                            printf(“Address of variable is %x ”, &var);

                            printf(“Address stored in ip variable is :%x”,ip);

                            printf(“value of *ip variable : %d”, *ip);

                            return 0;

                         }  



Share to whatsapp

More Questions from Data Structures and Algorithms Module 1

Define array. Explain review of arrays


View

Explain unions in data structure 


View

Explain declaration, initialization of One dimensional and Two dimensional arrays.


View

Define string. Explain string handling functions


View

Define polynomials. Explain Abstract data type in polynomial ?


View

Explain Structure ?  Define briefly about Memory representation of structure and structure initialization.


View

Why do we need dynamic memory allocation techniques? Explain the functions available for allocating memory dynamically.


View