| | |
Help with struct and double pointer (code inside)
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
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).
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).
•
•
Join Date: Sep 2007
Posts: 38
Reputation:
Solved Threads: 0
•
•
•
•
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).
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?
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.
You can always create the double pointer at any time by &students, so if the need would arise it has a simple solution.
![]() |
Similar Threads
Other Threads in the C Forum
- Previous Thread: rfc 1950 socket level deflate/inflate coding
- Next Thread: C program
| Thread Tools | Search this Thread |
Tag cloud for C
#include * append array arrays asterisks binarysearch calculate changingto char character cm copyimagefile cprogramme creafecopyofanytypeoffileinc database directory dynamic execv feet fflush fgets file fork forloop framework function getlasterror givemetehcodez grade gtkwinlinux hacking histogram inches include incrementoperators input intmain() iso kernel keyboard km lazy license linked linkedlist linux list lists locate logical_drives looping loopinsideloop. lowest matrix microsoft motherboard mqqueue number oddnumber odf opendocumentformat opensource overwrite owf pattern pdf performance pointer posix problem probleminc process program programming radix recursion recv recvblocked research reversing scanf scripting segmentationfault sequential socket socketprograming standard string systemcall testing threads turboc unix user variable voidmain() wab whythiscodecausesegmentationfault windowsapi





