![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
Problem with typedef struct, cannot malloc(sizeof(struct element)); unless at the topHere is the .c, THIS will work
CPP / C++ / C Code:
CPP / C++ / C Code:
BUT, this one will not work: CPP / C++ / C Code:
compiler error: Quote:
Keep in mind that temp has allready been malloc'ed, SOOOOO why won't the second one work? Do I have to do ALL my malloc'ing at the beginning of the function? I don't get it, temp has nothing to do with temp3 OR even p_addy3! Or does it... |
|
#2
|
|||
|
|||
|
Maybe your compile dosn't allow nested declarations.
EDIT: I get the same type of thing with Borland, so it probably is the fact that it's nested. |
|
#3
|
|||
|
|||
|
Quote:
OMG, that's right, I'm writing in C! I think only cpp allows declerations "willy nilly". Thanks. BTW, I'm using VC++ 2003 .NET Thanks. |
Recent GIDBlog
Toyota - 2008 September Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 2D arrays:dynamic allocation and freeing | bravetanveer | C Programming Language | 48 | 27-Nov-2007 15:55 |
| Urgent ! Pls Help Me ! | mycashmoney | C Programming Language | 4 | 01-Jul-2006 22:49 |
| [Tutorial] GUI programming with FLTK | dsmith | FLTK Forum | 10 | 03-Oct-2005 15:41 |
| problem on typedef | fwongmc | C Programming Language | 10 | 24-Dec-2004 03:54 |
| typedef struct problem | grizli | C Programming Language | 8 | 19-Jun-2004 16:32 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The