Rozmiar: 8938 bajtów


Pointer arithmetic



: Pointer arithmetic is a particular arithmetic involving pointers, typical of the C programming language. In pointer arithmetic, the unit is the size of the pointer's type. For example, adding 1 to a pointer to integer values (which typically span 4 bytes) will increment the pointer by 4. But, the end result will be in the pointer pointing right at the next element, which was probably the intended result. Pointer arithmetic provides the programmer with a single way of dealing with different types: adding and subtracting the number of elements required instead of the actual offset in bytes. In particular, the C definition explicitly declares that the syntax ''a[n]'', which is the ''n-th'' element of the array pointed by ''a'', is equivalent to ''*(a+n)'', which is the content of the element pointed by ''a+n''. While powerful, pointer arithmetic can be a source of computer bugs. It tends to confuse programmers, forcing them into different contexts: an expression can be an ordinary arithmetic one or a pointer arithmetic one, and sometimes it is easy to mistake one for the other. Many modern high level computer languages (for example Java programming language) do not permit direct access to memory using addresses, so concepts of pointers and pointer arithmetic are not relevant. This is deliberate, as many programming tasks do not require specific knowledge of where and how in computer memory data is stored.


See other meanings of words starting from letter:

P

PA | PB | PC | PD | PE | PF | PG | PH | PI | PJ | PK | PL | PM | PN | PO | PR | PS | PT | PU | PW | PX | PY | PZ |

Words begining with Pointer_arithmetic:

Pointer_arithmetic


These materials are based on Wikipedia and licensed under the GNU FDL



YouTube.com videos better site than Turbo Tax 2007
encyklopedia online