This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: dereferencing pointer to incomplete type


At 18:27 02.04.2008 +0300, std07181@di.uoa.gr wrote:


>-- 
>Please help me with this problem.
>
>My code:
>#include <stdio.h>
>#include <stdlib.h>
>#include "katalogos.h"
>
>#define PLITHOS 10
>typedef struct diplistiva{
>   int akorifi;
>   int dkorifi;
>   stixio pinakas[PLITHOS];
>}diplistiva;
>
>doublestack create()
>{doublestack ThisStoiva;
>        ThisStoiva=malloc(sizeof(diplistiva));
>        ThisStoiva->akorifi = -1;  (HERE)

Why do you use "malloc" and not "new doublestack"? Is this C or C++?
Anyway, I guess you should declare it as pointer, as in
doublestack* ThisStoiva;

bye  Fabi



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]