I wrote the following code, there is some difference exist but I can't figure it out.
typedef struct {
char* ch;
int length;
}Hstring;
int Strlength(Hstring* s) {
return s->length; // if I use s.length there, error occurs.
}
int Strlength(Hstring s) {
return s.length; // if I use s->length there, error occurs.
}
So what the differences between the two types? Will I get the same result? and why those errors occur?