If I am not allowed to use the <string.h> library, how can I easily compare values of a string. I have a data file with 6 possible values for one member of a structure. All I need to do is create a loop to count how many of each value is present in an array of structs. The problem is, I cannot figure out how to compare the value and thus when to increment the counter.
for (i = 0; i < datasize; i++){
if (struct.membervalue == given)
givencount++;
if (struct.membervalue == given2) // But I can't compare them with the ==
givencount2++ ; // because they are strings.
}
EDIT: predefined enum that I MUST USE
typedef enum {
penny = 1,
nickel = 5,
dime = 10,
quarter = 25
}changeT;
I have the value "penny" how do I compare to this or relate it?
strcmp()???==should work fine.