Memory allocation for pointers in C#

unsafe {
    //pointer to int value
    int* pInt = stackalloc int[1];
    *pInt = 50; //->Error
    
    //pointer to double
    double* pDouble = stackalloc double[1];
    double d = 3.14;
    *pDouble = d;
}