Pointer arithmetic is another name for address arithmetic. A pointer is moved by a multiple of the size of the data type it points to when it is added or subtracted from. Consider the following scenario: we have a pointer to a 4-byte integer array. This pointer's value will be increased by 4 by incrementing it (the size of the element).
When a pointer is incremented, the size of the data type for which it is a pointer is increased by the same number. For example, if an integer pointer that holds address 1000 is incremented, the new address will be 1002, and the new address will be 2(size of an int).
The following are the only allowed arithmetic operations on pointers: Addition of integers to a pointer. Integer subtraction from a pointer. Taking the difference between two pointers of the same type.
When you need to get a pointer back, you normally utilise pointer arithmetic. To retrieve a pointer with an array index, you must first calculate the pointer offset, then get the value at that memory position, and finally use & to get the address back. There will be more typing and less crisp syntax as a result of this.
On the pointers, we can do arithmetic operations such as addition, subtraction, and so on. However, because the address is stored in the pointer, the result of an arithmetic operation on the pointer will also be a pointer if the other operand is of type integer.
Learner's Ratings
4.4
Overall Rating
69%
18%
5%
5%
3%
Reviews
U
Ujwal Sadafale
5
VERY USEFULL EXPERIENCE
N
Nirali K Patel
5
N
P
Prabhat Yadav
5
Superb and amazing 😍🤩 enjoyable experience.
S
sahil namdev
5
Nice teaching sence... I like this platform..
J
Jayprakash Rajput
5
Your teaching style is very very good.and simple.
B
Bidisha Manna
5
It is a very good C programming language course. Yes it is.
D
Deepak Kumar
5
best matarial in hindi medium student
W
Wali ullah
5
that are very best ara learnig skill so that are the best of best
Share a personalized message with your friends.