Originally Posted by
hotwheelharry
like...
Code:
typedef Console* ConsoleRef;
typedef struct
{
//console properties
int Number;
void (*Hide)(ConsoleRef);
void (*Show)(ConsoleRef);
short x;
short y;
short width;
short height;
} Console;
How exactly did you mean?
You're doing a typedef of struct "nothing" to console.
And the first typedef doesn't work.
An example that works:
Code:
#include <stdio.h>
struct console;
typedef struct console *console_ptr;
typedef struct console {
int a;
console_ptr c_p;
} console;
int main(void)
{
console c = {.a = 0, .c_p = NULL,};
printf("c.a = %d\n", c.a);
return 0;
}
Also those are not references, which don't even exist in c, but pointers.