P
pashmina g.
Hi,
I'm reading the book "The C programming Language". I'm trying to do an
exercise asking to find the longest line. I'm reading the book in
sequence hence I shouldn't know anything about pointer yet.
As a string is declared with "char string[n]", the length is already
specified, how can I store an arbitrary long string? I've tried to do
something like
char string[10];
....
char string2[20];
string = string2;
but it complains about incompatible types. And it wouldn't work either
if I use a 2 dimensional character array as the total length is still
fixed.
Thanks for help.
Pashmina
I'm reading the book "The C programming Language". I'm trying to do an
exercise asking to find the longest line. I'm reading the book in
sequence hence I shouldn't know anything about pointer yet.
As a string is declared with "char string[n]", the length is already
specified, how can I store an arbitrary long string? I've tried to do
something like
char string[10];
....
char string2[20];
string = string2;
but it complains about incompatible types. And it wouldn't work either
if I use a 2 dimensional character array as the total length is still
fixed.
Thanks for help.
Pashmina