Google
 
Webcprogramming.com




An Affiliate of AIHorizon




Declaring a Pointer to a Struct

The syntax for declaring struct instances in C and C++ differs. In C, if you do not typedef the struct, you must precede the name of struct type the keyword struct. In C++, this is not required. In either case, to declare a pointer to a struct, you simply precede the name of the instance with a *.

In C++:
struct_name *struct_instance;
In C:
struct_name_t *struct_instance;  /* struct_name_t must be a typedef */
or
struct struct_name *struct_instance;

-----
Interested in advertising with us?
Please read our privacy policy.
Copyright © 1997-2005 Cprogramming.com. All rights reserved.

Geodesy Designs