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%
4%
4%
Reviews
A
Abhinay Pandey
5
Best plateform for beginners student,those study any language
S
Shaharbano Manihar
5
very good platform for learn programming languages
K
kamlesh kumawat914
5
supper
J
Jitender sharma
5
mast
B
BHUPAL SINGH
5
Bahut achha paryas behtreen skill for teach c programming love u athrva bro
T
Tech AmitCS
5
most imfrodt...............
S
shubham jangid
5
Nice for BCA students to learn programming.
A
Anjali malviya
5
C language program
M
Malhar Dapse
5
good good
P
Patel tishika
5
this application is very helpfully for learning to programing languages.
Share a personalized message with your friends.