• + 2 comments

    Can someone explain why I need to use :

    int *arr = malloc(n*sizeof(int));

    instead of:

    int arr[n];

    Where is the difference and what advantage do I gain from it ? Thank you in advance!