answersLogoWhite

0

Arithmetic operators can be performed on pointers in C and C++ to navigate through arrays or memory blocks. The most common operations include addition and subtraction, which adjust the pointer's address by multiplying the integer value by the size of the data type it points to. Incrementing a pointer (using ++ or --) moves it to the next or previous element in the array, while subtracting two pointers yields the number of elements between them. However, using multiplication and division with pointers is not defined.

User Avatar

AnswerBot

∙ 1y ago
User Avatar

What else can I help you with?

Related Questions

Which two pointer does not increment or decrement in arithmetic array?

constant pointer and character pointer


Why can't I perform arithmetic on a void pointer?

It's by design. You can still do it, with type-cast: void *p; p= (void *)((char *)p + 256);


What are the functions of arithmetic logic unit?

The Arithmetic Logic Unit as suggested by the name carries out the arithmetic calculations of the computer.


What is the effect of various arithmetic operators on a pointers?

Error message, mainly. The following operations are legal: ptr + integer (pointer) ptr - integer (pointer) ptr - ptr (integer)


How do you perform arithmetic operations on binary numbers?

There are a few rules to perform arithmetic operations in binary numbers. According to those rules you can add or subtract binary numbers. There are only two arithmetic operations used in binary numbers, they are addition and subtraction.


What arithmetic operator directs Excel to perform the division operation?

the divide symbol (/)


Is it true the arithmetic operator directs excel to perform the division operation?

true


Which part of CPU perform logical function?

ALU-Arithmetic and logic unit.


What jobs do computer operators perform?

"Computer operaters can preform virus detection, as well as programming . They are also able to set up and run spechilized programes that are much to complex for most people."


What is a Arithmetic logical unit?

The Arithmetic Logic Unit (ALU) is the heart of a CPU. This is what allows the computer to add, subtract, and to perform basic logical operations.


What are the operaters used in VBNET?

In VB.NET, operators are used to perform operations on variables and values. The main categories of operators include arithmetic operators (e.g., +, -, *, /, Mod), relational operators (e.g., =, <>, <, >, <=, >=), logical operators (e.g., And, Or, Not), and bitwise operators (e.g., And, Or, Xor, Not). Additionally, VB.NET includes assignment operators (e.g., =, +=, -=) and concatenation operators (e.g., & for strings). These operators enable developers to manipulate data and control program flow effectively.


A character Array is defined as char Array 200 150 50 find the address of cell Array 125 80 20?

It is inappropriate and non-portable to consider the address or the relative address of a particular item in an array, because different compiler implementations might be different. Even within the same implementation, there might be issues due to alignment or segmentation. That said, it is perfectly legal and defined to assign a pointer to the address of an element and then perform arithmetic on the pointer, with consistent results. You should not, however, consider the "arithmetic" value of the pointer to have any particular meaning, especially since the concept of "adding one" to such a pointer means to add by the number of bytes in a single element, not (as thought) to add by one. Such "pointer arithmetic" is not advised (or defined ??) when you step beyond the bounds of any one sub-array, again, due to possible alignment issues. Consider your example of an array of char [200][150][50]. You can theoretically think of the memory layout as simply being sequential, with the left-most index varying quickest, and that might work 99.99% of the time. I go for the 100% case and treat the pointer as an opaque object, with no consideration of its internal representation.