How to return a char array from a function in C
#include <stdio.h>
#include <string.h>
char* createStr(){
static char str[20] = "my";
return str;
}
int main(){
char a[20];
strcpy(a,createStr()); //this will copy the returned value of createStr() into a[]
printf("%s",a);
return 0;
}