Friday, October 1, 2010

Structure Pointers in C, C++

C/C++ allows pointers to structures just as it allows pointers to any other type
of variable. However, there are some special aspects to structure pointers that
you should know.


Declaring a Structure Pointer
 
Like other pointers, structure pointers are declared by placing * in front of a structure
variable's name. For example, assuming the previously defined structure addr, the
following declares addr_pointer as a pointer to data of that type:
struct addr *addr_pointer;
Remember, in C++ it is not necessary to precede this declaration with the keyword
struct.

No comments:

Post a Comment