J
jb.simon
Given the following code :
#include <stdio.h>
typedef struct Handler
{
int data1 ;
int data2 ;
int data3 ;
void ( *cb ) ( Handler * ) ;
} Handler ;
void callBack ( Handler * handler ) ;
int main ( void )
{
Handler myHandler ;
myHandler.cb = callBack ;
myHandler.cb ( &myHandler ) ;
return 0 ;
}
void callBack ( Handler * handler )
{
printf ( "\nData 1 = %d\n\n", handler->data1 ) ;
}
When I compile it I get:
/export/SAN1/simonj/test/typedef > gcc -std=c89 -Wall -pedantic test.c
test.c:10: error: parse error before '*' token
Any ideas ?
Thanks !
Joe
#include <stdio.h>
typedef struct Handler
{
int data1 ;
int data2 ;
int data3 ;
void ( *cb ) ( Handler * ) ;
} Handler ;
void callBack ( Handler * handler ) ;
int main ( void )
{
Handler myHandler ;
myHandler.cb = callBack ;
myHandler.cb ( &myHandler ) ;
return 0 ;
}
void callBack ( Handler * handler )
{
printf ( "\nData 1 = %d\n\n", handler->data1 ) ;
}
When I compile it I get:
/export/SAN1/simonj/test/typedef > gcc -std=c89 -Wall -pedantic test.c
test.c:10: error: parse error before '*' token
Any ideas ?
Thanks !
Joe