Re: how to passing cofunc as parameter to another function
"hongyang74" <[email protected]>
| Newsgroups | gmane.comp.hardware.rabbit-semiconductor |
|---|---|
| Message-ID | <[email protected]> |
wfd returns integer, not char *.
The correct codes are followed:
cofunc char *getMonth(int num){
static char *const months[12] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
if(num>=1 && num<=12) return (months[num-1]);
}
void main() {
char buffer[15];
int s;
char *b;
costate {
memset(buffer, '\0', sizeof(buffer));
wfd b=getMonth(1);
memcpy(buffer, b, sizeof(buffer));
printf("Month: %s", buffer);
}
}