Here is a simple program to demonstrate my problem.
I have a function functionB
which passes pointer to a character array to functionA
. functionA
finds the value and stores it to a character array. The content of character array should be copied to character pointer fdate
. How can I achieve this?
int functionB() {
char fdate[20];
functionA(&fdate[0]);
return 0;
}
int functionA(char *fdate) {
char date[20] = "20 May 2016";
strcpy(fdate, date);
return 0;
}
Aucun commentaire:
Enregistrer un commentaire