943,885 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Marked Solved
  • Views: 3849
  • C RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Nov 17th, 2008
1

Re: Help with struct and double pointer (code inside)

It is only a pointer, don't worry. It's a pointer that points to pointers.

The struct declaration indeed only reserves one pointer, not an array or anything.

However, I guess you want to have *students in your struct. An "array" of students, right? That makes a bit more sense than what you have now (which resembles a 2D array of students).
Reputation Points: 69
Solved Threads: 28
Posting Whiz
Clockowl is offline Offline
376 posts
since May 2008
Nov 18th, 2008
0

Re: Help with struct and double pointer (code inside)

Click to Expand / Collapse  Quote originally posted by Clockowl ...
It is only a pointer, don't worry. It's a pointer that points to pointers.

The struct declaration indeed only reserves one pointer, not an array or anything.

However, I guess you want to have *students in your struct. An "array" of students, right? That makes a bit more sense than what you have now (which resembles a 2D array of students).
Yes, if I've understood properly, for my purpose it's enough an "array of students", I only want to list the students in the school with their exams.
Now, I'm asking myself, why in the spec, that was given as a hint for implementaion, there's such a double pointer variable, is it somewhat better, for ex. more flexible or efficient?
Reputation Points: 10
Solved Threads: 0
Light Poster
BigFormat is offline Offline
45 posts
since Sep 2007
Nov 18th, 2008
0

Re: Help with struct and double pointer (code inside)

Not in any imaginable way if you ask me. Like I said, a pointer to an array of pointers (an array of "arrays") resembles a 2D array. Unless you want that, there's no use for a double pointer.

You can always create the double pointer at any time by &students, so if the need would arise it has a simple solution.
Reputation Points: 69
Solved Threads: 28
Posting Whiz
Clockowl is offline Offline
376 posts
since May 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: rfc 1950 socket level deflate/inflate coding
Next Thread in C Forum Timeline: C program





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC