+ 1
I am in trouble with this question . Could someone help me ?
Write a user-defined function which gets a pointer to a character string (that is a twodimensional array) containing the name of months. Function will return the name of month depending on its arguments. For example : if it gets 2 it will return February. if it gets 0 it will return illegal month (Array index starts from 0 ) if it gets 9 it will return September
10 Answers
+ 5
Your array is declared like this:
char months[][10] = {"January", "February", ...};
Your function like this:
char *getMonth(int month) { ... }
Your code needs to take 1 to 12 for the month, change it to 0 to 11 for the months array index, and return months[index]. It should make sure the month is in range and, if not, return NULL to prevent an array index out of bounds returning random garbage. Your main program should test the function a few times with both good and bad month numbers printing the string or an error message.
+ 4
Add code into SoloLearn playground to link it. I'm constantly logged in, but do have other things that I must do as my real life comes first. 6 to 10 hours from now tends to be family time.
+ 3
If I write your program, you learn nothing. Show me your effort trying and I'll help fix it.
+ 3
Link your code here. I live here so likely yes.
0
That is what I need to do but I can't applicate this . Have you chance to write this program and send me ? I have been trying to write this for two weeks ?
0
Okey. I am not at home now I will show within 5 6 hours . Will you be available ?
0
I did not write here . I wrote my code with my computer and my pc is not around me now
0
I will send here within 4 or 5 hours later thank you before your help :))
0
You're right but I can,t send now. If you send me correct code,I will check at night even you dont online
0
posted comment in the java