Why do i get a Run-Time Check Failure #2 (completely Beginner)
03:40 12 Nov 2025

Im new to C Programming and the Windows API im getting "Run-Time Check Failure #2 - Stack around the variable 'pMyStringAdress' was corrupted." after compilation in Visual Studio

Thats my code:

#include 
#include 
#include 

char MyStrings[] = {
    "ich bin ein text"
};


int main() {
    
    SIZE_T SizeMyStrings = sizeof(MyStrings);

    PVOID pMyStringAdress = VirtualAlloc(
        NULL,
        SizeMyStrings,
        MEM_COMMIT | MEM_RESERVE,
        PAGE_READWRITE
    );

    if (pMyStringAdress == NULL) {
        printf("VirtualAlloc fehlgeschlagen mit fehlercode %d", GetLastError());
    }
    else {
        printf("Speicher erfolgreich allokiert sitzt bei: %p\n", &pMyStringAdress);
    }

    printf("Probiere in den Speicher zu schreiben.");

    memcpy(&pMyStringAdress, MyStrings, SizeMyStrings);
    
    return 0;
}
c windows