So, I'm basically trying to assign my structure with strings as 0, so then I could change some values later, but I'm getting the warning of "strcpy makes pointer from integer without a cast" and the code is not working how can I fix it?
my structure is this
struct node{
char ID[3];
char Name[40];
char Code[3];
};
and here is my function
void initialiseArray(struct node* arr){
int i;
for(i = 0; i < capacity; i ){
strcpy(arr[i].ID[3], "0");
strcpy(arr[i].Name[40], "0");
strcpy(arr[i].Code[3], "0");
}
}
CodePudding user response:
arr[i].ID[3]
in the function definition must be arr[i].ID
. Same for the other two fields. arr[i].ID[3]
is a [nonexistant] character of a string, not the string.