Use 2D arrays as:
char discountUser[N][32];
char notDiscountUser[N][32];
where N
is max number of users, you can #define
it to some value.
What you are trying to do is:
char discountUser[32];
This is a string, if you use char discountUser[i]
you are referring to the char
(A single character, not a string) at index i
in the string discountUser
.
Now, strcpy
expects a string as input to both of its arguments, therefore you cannot pass discountuser[i]
as its input.
When you declare a 2D array as I told above, discountuser[i]
will refer to a string
(actually dicountuser[i]
will act as char
pointer), so now you are allowed to pass it as argument to strcpy
.