I want to cast malloc in a function , and i have this code:

```
#include <stdio.h>
#include <stdlib.h>
#define maxLength 4
typedef short int *set;

    void func(set *a)
    { 
      func1(a);
    }

    void func1(set *a)
    {
        *a=malloc(maxLength*sizeof(set));
        (*a)[0]=10;
        (*a)[1]=13;
        (*a)[2]=15;
    }

    void main()
    {
        set a;
        func(&a);
        printf("%d %d %d",a[0],a[1],a[2]);

    }

```

VS2010 CODE:

```
#include <stdlib.h>
#include "stdafx.h"
#include <stdio.h>
#include "12.h"
#define maxLength 4
typedef int *set;

void func(set *a){
    func(a);
}

void func1(set *a){
        *a=reinterpret_cast<set>(malloc(maxLength*sizeof(set)));
               (*a)[0]=10;
               (*a)[1]=13;
               (*a)[2]=15;
}

```

is this the way to do it in VS2010 ? because it compiled but crashed 
CRASH DETAILS : `Unhandled exception at 0x00c610a9 in 11.exe: 0xC00000FD: Stack overflow.`
because in CODE BLOCKS it worked perfect

THE QUESTION IS: WHY IT DOES WORK IN CODE BLOCKS , BUT IN VS2010 DOES NOT