C and C++ have variables that hold memory addresses. These are called pointers. Pointers are an extremely powerful programming feature, long regarded as essential to any full-strength programming language. But the power of pointers also comes at a price, and safe use of pointers turns out to be rather difficult in large programs and the source of many bugs. The most common uses of pointers are:
• Working with arrays, especially char arrays.
• For dynamic memory allocation of data structures.
• To link data structures together.
Pointers are so powerful they are dangerous. They are dangerous because they can access any memory location and a small error in their use can have mysteriously bizarre results, often showing up only later in execution or when the program is run in a different environment. It is estimated that about 50% of the bugs in production ("shrink-wrapped") software are due to pointer misuse. Consequently, some languages do not have pointers, and only have a more restricted use of memory addresses called references.
google ads
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment