I need to call a function from the main to determine a string value. However, as far as I know, string cannot be in the form string_name  = call_function(). The assignment of string has to be in form of strcpy(str1, str2) right? So I am wondering what am I doing wrong with this strcpy with str1 as the variable name and the str2 is a return string value from another function.
So far, this is what I have.
#include <stdio.h>
#include <string.h>
char *get_name(int num);
char *get_name(int num) {
    char real_name[30];
    
    if (num == 1)
        strcpy(real_name, "Jake Peralta");
    
    return real_name;
}
void main() {
    char name[30];
    int num;
    
    num = 1;
    
    strcpy(name, *get_name(num));
    printf("%s", name);
}
It is not printing anything on my output screen.
What I have tried :
- get_name(num)without using pointers (still does not work)
p/s: This is not the actual code. This is just an example of what I am trying to do, the actual code is longer and I have identified that this part is where the error is coming from.
 
     
     
     
    