   Problem with structs and strings in C
  Keep in mind my program is written in C ( not C++ ).I have a function which takes two structs as parameters is supposed to put the values of the source struct in the destination struct. Only the first character is put into the destination struct for each field.void AssignValues(info *source, info *destination){*destination->name = *source->name;*destination->class = *source->class;*destination->alignment = *source->alignment;}  Name, class and alignment are defined aschar variableName[20];In a struct called info.If my source is : test, TEST exampleThe destination is : t, T, eWhy is that ?Thanks for your help. 
  The type of "source" is "info *" and the type of "source->name" is "char *" (or "char [20]"). When you dereference "source->name", you''re dereferencing a character array/pointer so you''re doing the equivalent of:destination->name[0] = source->name[0];  Using the "->" operator does the data-access-off-a-pointer that you''re looking for. What you''re probably going for is either a pointer copy, ala:destination->name = source->name;  ...or, more likely, a string copy:strcpy(destination->name, source->name);  Hope this helps. ;  Because you are defining name as an ARRAY of chars and you are only copying one char across.Given you''re copying everything anyway in AssignValues(), why not do this:void AssignValues(info *source, info *destination){memcpy (destination, source, sizeof(info));}.. which would copy everything. If you want to fix the string copy correctly, try using strcpy instead as that will move the entire char array stopping at the 0 terminator.strcpy(destination->..., source->...); instead of the* lines.Or something like that :-);  Thanks guys, it works and your explanations were also very useful ! 