For example, which term completes the sentence "
p has 5 ____" in order to describe a situation like
A pointer is used to point to a memory location of a variable. A pointer stores the address of a variable and the value of a variable can be accessed using dereferencing of the pointer. A pointer is generally initialized as:
datatype *variable name;
This above declaration is a single pointer but there can be more than this. This is called levels of pointers. According to ANSI C, each compiler must have at least 12 levels of pointers. This means we can use 12 * symbols with a variable name.
Level Of Pointers in C/C++:
Level of pointers or say chain can go up to N level depending upon the memory size. If you want to create a pointer of level-5, you need to precede the pointer variable name by 5 asterisks(*) at the time of declaration.
- C++ Pointers: Number of levels of Indirection, and
- ANSI C allows for up to 12 levels of pointers. Why would you ever use more than 3 or 4 levels?
Just to be clear, this 12 thing they keep going on about is just counting how many *'s you can use in one go. But you can stick it in a loop and dereference as many times as you like. Well, so long as the value you find there never sends you outside of addressable memory.