Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C - C++ Learning > Re: A question ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 11 Topic 4120 of 4295
Post > Topic >>

Re: A question about structures

by Barry Schwarz <schwarzb@[EMAIL PROTECTED] > Apr 19, 2008 at 10:55 AM

On Sat, 19 Apr 2008 11:06:19 -0400, Pat
<pkelecy@[EMAIL PROTECTED]
> wrote:

>I'm in the process of teaching myself C++ (with the help of several good 
>books) so I can develop some DLL's for another application.
>
>Looking through an example of one of these, there's a line that defines 
>a structure as follows:
>
>struct ParameterDefinition primaryParams[]=
>{
>	{"x position =", kXpos, 1.0}
>	{"y position =", kYpos, 2.0}
>	{"z position =", kZpos, 0.0}
>};
>
>
>None of the books I've been reviewing define a structure in this way (at 
>least so far).   So what is "ParameterDefinition"?  A pointer?  I assume 
>it actually contains the code that defines this  structure type.  Is 
>there a name for this way defining a structure?  I'd like to read more 
>about that.

This is an definition of an array of struct.  The structure type
(struct ParameterDefinition) has been declared elsewhere, possibly in
a header.  From this code we can deduce the following

	As a type, struct ParameterDefinition has at least three
members.

	The first member is of a type that can hold either a set of at
least 12 characters (but more likely at least 13 to include the
terminating '\0' so the set can be treated as a string) or a pointer
to a string.  It could be an array of char or a pointer to char.

	The second member is of a type that is compatible with the
k-pos variables (or perhaps they are macros or enums).

	The third member is probably of a floating point type.

	The array primaryParams contains exactly three elements of
this structure, each of which is initialized with the corresponding
set of data provided.

	If there are any other members of the struct, each is
initialized to 0, NULL, or 0.0 as appropriate for its type.


Remove del for email
 




 11 Posts in Topic:
A question about structures
Pat <pkelecy@[EMAIL PR  2008-04-19 11:06:19 
Re: A question about structures
Francis Glassborow <fr  2008-04-19 16:20:42 
Re: A question about structures
Pat <pkelecy@[EMAIL PR  2008-04-19 17:13:44 
Re: A question about structures
Jensen Somers <jensen.  2008-04-19 23:25:38 
Re: A question about structures
Pat <pkelecy@[EMAIL PR  2008-04-19 19:38:17 
Re: A question about structures
Barry Schwarz <schwarz  2008-04-19 10:55:40 
Re: A question about structures
Pat <pkelecy@[EMAIL PR  2008-04-19 17:30:48 
Re: A question about structures
Richard Heathfield <rj  2008-04-19 22:10:45 
Re: A question about structures
Pat <pkelecy@[EMAIL PR  2008-04-19 19:38:01 
Re: A question about structures
Jensen Somers <jensen.  2008-04-20 13:35:43 
Re: A question about structures
Pat <pkelecy@[EMAIL PR  2008-04-20 11:09:30 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 6 16:01:29 CDT 2008.