Posts

Showing posts from February, 2022

Introduction to Pointers in C

What are Pointers in C?  A pointer is a variable that holds the address of another variable. A pointer is a derived data type in C. All the computers have addressable memory locations. The value of these variables is stored in these memories only. We can access these values of the variable in 2 ways: (i) By using the name of the variable. (ii) By using the address of a variable. The use of pointers are made in the second method Values stored in pointers are addresses, where data is stored in memory. Example:           int i = 8;           i → name of the variable           8 → value at address           65599 → address in the memory. How to Use Pointers in C? If we declare a variable i of type int, it will store a value.  int i = 0 The value of i is 0 now However, each variable, apart from value, also has its own address (or the address of the location where the value is saved i...