I have a struct WRITER and I made
typedef WRITER* WriterPtr;
also there is another struct called BOOK and a
typedef BOOK* BookPtr
in my BOOK struct I have a
WriterPtr writerPtr; //pointer to the writer struct
now I have a func:
void choiceA(BookPtr parr, int n,WriterPtr *pWriter, int *psize)
I did realloc to add a new writter to my dynamic array of writers like that-
WriterPtr ptr=(WriterPtr)realloc(*pWriter,(*psize+1)*sizeof(WRITER)))==NULL); //I did a check that there was enough space
*pWriter=ptr;
(*psize)++;
and I initialized the writers data but I'm having a hard time putting the new writer struct into book!! like I said in my BOOK struct I have a
WriterPtr writerPtr; //pointer to the writer struct
can anyone please help me to put the address of the new writer into that pointer?
I tried a lot of stuff but because my func gets **pWriter (WriterPtr *pWriter) I'm having a hard time figuring out how to do it right!!:@
here's what I tried
parr.writerPtr=(*pWriter+*psize);
parr.writerPtr=pWriter[*psize];