What is a pointer in C programming language:
It is the same as pointing something it's basically a pointer that points to the address of a memory box.
Eg: When we declare a variable or array or matrix it requires space to be operated, the CPU manages the memory by using a particular place for each variable and that place can be seen through a pointer. By knowing and excessing that place we can find many help full tricks for programming. E.g it is not possible to return more than one value from a function, so to return more than one value from a function we can use Global variable or pointers. Using global variables can be harmful as each function can't be trusted, so we try to make use of pointers.
If I declare a variable and store 5 in that variable then I can use a pointer to know its address in memory just look at the diagram below:
The value of the variable is 5 and its address is 100: |
There are some basic programs that will make you easier to understand pointers:
1- Add and subtract pointer of the same type.
FOR CODE CLICK HERE: 👉👉 ADD and Subtract (pointers)
-----------------------------------------------------------------------------------------------------------------------------2- Add two matrix using pointers and functions.
FOR CODE CLICK HERE: 👉👉 Add Matrix(pointers)
-----------------------------------------------------------------------------------------------------------------------------
Outstanding ❤
ReplyDeletePrecious 💝
ReplyDeleteGot all my concepts cleared.
ReplyDelete