Integer vs. Pointer

Difference Between Integer and Pointer

Integer

An integer is a type of data that represents subset of mathematical integers. There are two types of integers- signed or unsigned. Signed means the integers can represent negative integers and unsigned mean they can represent non-negative integers. The most common way of representing a positive integer is a string of bits. There is a variation in the order of bits. The precision or width of an integer type represents the number of bits.

Different types of integers are supported by different CPUs. Both signed as well as unsigned types are supported by different hardware but there are some fixed width sets.

Pointer

A pointer is a data type whose value directly refers to another value that is stored somewhere in the memory of the computer. A pointer refers to a location in the memory. They are supported by quite a large number programming languages but there are some limitations on the use of pointers in some languages.

Performance can be improved significantly in case of repetitive operations such as lookup tables, tree structures, strings and control tables. Pointers are also used in holding addresses of entry points and to bind methods in functions.