this is my .h file:
struct _MyString;
typedef struct _MyString MyString;
i would like to declare its members in the .c file.
i tried:
typedef struct MyString{
char * _str;// pointer to the matrix
unsigned long _strLength;
}MyString;
but it doesn't work. how do i declare the struct's memebers in the .c file?
thank you
You need only 1 typedef. Keep the one you already have in the .h file and delete all others.
Now, the struct name is struct _MyString
. That is what you should define in the .c file, not struct MyString
: notice the absence of the '_'.
So
.h file
struct _MyString;
typedef struct _MyString MyString;
.c file
#include "file.h"
struct _MyString {
char * _str;// pointer to the matrix
unsigned long _strLength;
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With