i have watched tutorial that explain how to return array from function
and this is similar code
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int *grn();
int main()
{
    int *a;
    a=grn();
    for(int i = 0;i<10;i++){
        printf("%d\n",a[i]);
    }
    return 0;
}
int *grn(){
    static int arrayy[10];
    srand((unsigned) time(NULL));
    for(int i=0;i<10;i++){
        arrayy[i]=rand();
    }
    return arrayy;
}
and i have some questions about it.. it is work fine and generate random values inside the array but
- why the function - grnis pointer
- and why - a variablein the- main functionis pointer ?
- why the arrayy arrayis static?
- and why should i make the grn function pointer?
when i try to run this code but the arrayy variable is not static i get segmentation fault
 
    