Struct String
{
char s[ ];
}
when compiling the above code, error says a number need to be put into []. But what can do if I want to leave it 'open'??
This is a discussion on about arrays create within a struct~ within the C Programming forums, part of the General Programming Boards category; Struct String { char s[ ]; } when compiling the above code, error says a number need to be put ...
Struct String
{
char s[ ];
}
when compiling the above code, error says a number need to be put into []. But what can do if I want to leave it 'open'??
change to
char *s;
And remember to assign an allocated memory pointer to s
====>
char s[] is equivalent to char *s but slightly different
char s[] ==> s is not a LValue and can not be modified
char *s ==> s can be manipulated, assignment, increment, decrement .....