this is my first C language coding. It is for my coursework and I have some troubles.
- I want to pass a char[] as a parameter to a method
- I want to copy this char[] to another char[]. For this I am using strcpy.
So when I do:
main(){
char asd[20] = {"asd"};
insert(asd);
}
void insert(char value[]) //here value[] contains only 'd'
{
...code...
}
So basically, it is passing just one char, not the array. I tried with:
main(){
char *asd[20] = {"asd"};
insert(asd);
}
void insert(char *value[]) //here value[] contains 'asd'
{
char *secondArray[20] = {' '}
strcpy(secondArray,value); // char** incompatible with "const char*"
}
And I am stucked.