I am learning C and I want to implement a function that returns to main function a string. I have read some topics here but I got confused.. I wrote:
#include <stdio.h>
#include <string.h>
char myPrint(int);
int main()
{
char msg[10];
msg = myPrint(1);
printf("\n %s \n", msg);
}
char myPrint(int n)
{
char msg[10];
if(n==1)
strcpy(msg, "ACCEPT");
else
strcpy(msg, "DENY");
return msg;
}
and I get a bunch of warnings and error.. I read this for the usage of the strcpy and many others links relevant to this topic but I didn’t get it..