I tried you program on my machine and it run perfectly.
For compile the C program I used:
gcc main.c -o main.exe
when i run the file python i see:
Hello World!CompletedProcess(args='./main.exe', returncode=0)
The compiler that I use is:
gcc (MinGW.org GCC-6.3.0-1) 6.3.0
And the python version is 3.12.4