Originally Posted by Darkcoder
i dont think you know what a string is yet.. im just guessing. basicly the problem is your typing char cand1 = whatever when you should be typing cand1 = whatever. but if the names more than 15 characters just replace it with a higher number. there, easy explanation instead of :
or char *name1='mikey';
then recall it as a string.
printf("name1 = %s", name1);
you could also use an array.
that creates a string that can store 50 chars 0 - 49.
that can be referenced as a string also.
the char *name is a reference to a pointer, and is perfectly acceptable to contain a string. and can be used in the following method
str1 = getval("function");
to accept returns from functions of any length.
char name = 'name1';will create a char array with the correct amount of chars, wich takes the point away from the necessity to specify the amount of places in the char array as with the method. however the array is only created the size of the charspushed into it on creation.
char = 'too many spaces is a memory waste';
and can cause leaks when trying to push too many char into a memory space that isn't properly allocated.
In any case, all the outlined methods in this post are in accordance with ANSI C usage and will compile on any platform. ad are perfecty valid ways to use strings.
is a god place to start...