RE: [Dev-C++] Stress with structs and pointers.
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <iv...@em...> - 2003-06-12 07:56:51
|
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of David McKen
Sent: Thursday, June 12, 2003 3:16 AM
To: dev...@li...
Subject: [Dev-C++] Stress with structs and pointers.
Ok, I need some clarification on a couple topics invloving pointers and
pointers.
1) when a struct is created. All that can be assumed is that it contains
trash right? What is a portable way to initalize everything to 0? mset?
struct whatever_type s={0, 0, 0 ...};
2) when a structure contains a pointer. Access to the address (not the
value) comes in the form {struct_variable_name}.{member_name}?
Yes.
3) how do you de-refrence the pointer in #2 to get the value of the
variable? {struct_variable_name}.*{member_name}?
*struct_variable_name.pointer_name=...
or
*(struct_variable_name.pointer_name)=...
to make it easier to understand. I use the second.
4) if you have a pointer to the structure you access the members via '->'.
If a member of the structure is a pointer the address is gotten via
{struct_varible_name}->{member_name}?
Yes
If so how does one get the value of the varible?
{struct_variable_name}->*{member_name}?
*struct_variable_name->pointer_name=...
Ioannis Vranos
* Programming pages: http://www.noicys.freeurl.com
<http://www.noicys.freeurl.com/>
* Alternative URL 1: http://run.to/noicys
* Alternative URL 2: http://www.noicys.cjb.net <http://www.noicys.cjb.net/>
|