public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* dereferencing pointer to incomplete type
@ 2008-04-02 18:14 std07181
  2008-04-03  8:15 ` Fabian Cenedese
  2008-04-03  8:48 ` Dario Saccavino
  0 siblings, 2 replies; 3+ messages in thread
From: std07181 @ 2008-04-02 18:14 UTC (permalink / raw)
  To: gcc-help



-- 
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)
.
..
.
..
.
.

And my first part of types.h
typedef int stixio;

typedef struct  diplistiva *doublestack;

doublestack dimiourgia();


Why do i get that error?????

Please answer me as soon as possible it is very important


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dereferencing pointer to incomplete type
  2008-04-02 18:14 dereferencing pointer to incomplete type std07181
@ 2008-04-03  8:15 ` Fabian Cenedese
  2008-04-03  8:48 ` Dario Saccavino
  1 sibling, 0 replies; 3+ messages in thread
From: Fabian Cenedese @ 2008-04-03  8:15 UTC (permalink / raw)
  To: gcc-help

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dereferencing pointer to incomplete type
  2008-04-02 18:14 dereferencing pointer to incomplete type std07181
  2008-04-03  8:15 ` Fabian Cenedese
@ 2008-04-03  8:48 ` Dario Saccavino
  1 sibling, 0 replies; 3+ messages in thread
From: Dario Saccavino @ 2008-04-03  8:48 UTC (permalink / raw)
  To: std07181; +Cc: gcc-help

>
>  Why do i get that error?????
>
>  Please answer me as soon as possible it is very important
>

I've compiled your code and I don't get any error.
Are you sure you posted it correctly?

  Dario

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-04-03  8:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-02 18:14 dereferencing pointer to incomplete type std07181
2008-04-03  8:15 ` Fabian Cenedese
2008-04-03  8:48 ` Dario Saccavino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).