Hi,
I am trying to return a C String from a function but its not working. Here is my code.
char myFunction()
{
return "My String";
}
and then in main i am calling it like this.
int main()
{
printf("%s",myFunction());
}
I have also tried some other ways on myFunction but they are not working. E.g;
char myFunction()
{
char array[] = "my string";
return array;
}
Note: I am not allowed to use pointers!
Little Back Ground on this problem: There is function which is finding out which month it is e.g; if its 1 then it return January etc etc.
So when its going to print, it's doing like this. pritnf("Month: %s",calculateMonth(month));, No problem is how to return that string from calculateMonth Function.