+ 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

22nd Dec 2018, 8:23 AM
Nurullah Aydın
Nurullah Aydın - avatar
10 Réponses
+ 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.
22nd Dec 2018, 1:17 PM
John Wells
John Wells - avatar
+ 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.
22nd Dec 2018, 1:35 PM
John Wells
John Wells - avatar
+ 3
If I write your program, you learn nothing. Show me your effort trying and I'll help fix it.
22nd Dec 2018, 1:27 PM
John Wells
John Wells - avatar
+ 3
Link your code here. I live here so likely yes.
22nd Dec 2018, 1:30 PM
John Wells
John Wells - avatar
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 ?
22nd Dec 2018, 1:23 PM
Nurullah Aydın
Nurullah Aydın - avatar
0
Okey. I am not at home now I will show within 5 6 hours . Will you be available ?
22nd Dec 2018, 1:28 PM
Nurullah Aydın
Nurullah Aydın - avatar
0
I did not write here . I wrote my code with my computer and my pc is not around me now
22nd Dec 2018, 1:31 PM
Nurullah Aydın
Nurullah Aydın - avatar
0
I will send here within 4 or 5 hours later thank you before your help :))
22nd Dec 2018, 1:32 PM
Nurullah Aydın
Nurullah Aydın - avatar
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
22nd Dec 2018, 1:38 PM
Nurullah Aydın
Nurullah Aydın - avatar
0
posted comment in the java
22nd Dec 2018, 7:51 PM
Ḿổḩảḿḿẻď Ấḿiň
Ḿổḩảḿḿẻď Ấḿiň - avatar