anonymous
2010-03-16 21:57:34 UTC
Wants use strtok(), scanf(), and malloc()
Wants us to take care of all memory allocations ourselves.
I am stuck trying to implement this and need some guidance.
In particular I am confused with the difference between char *string; char string; and char[20] string;
And with how to use scanf();
especially in this assignment he wants us to use a while(scanf()) loop.
I tried getting my while scan f loop to work but to no avail.
I used char[20] string; followed by scanf("%s", string); and that worked but when i tried
char[20] string; and then a while(scanf("%s", string) that didn't work and
char[20] string; and then a while(scanf("%s", string == 1) that didn't work either
Additionally I think the format of the string reading the professor wants us to use is %as (i.e. scanf("%as", string)
I am not sure exactly what %as does or how to implement it correctly.
Thank you in advance
I am a previous Java user and am new to C so i need plenty of guidance as to which path to take and possible syntax.