Code:
char *Prog = (char *)malloc(strlen(x));
That part is wrong. It gives you enough characters to hold the string, but not the terminating nul byte ('\0'). You may not be planning to use them all, but your code indicates otherwise by its reference to x.

Be careful with your terminology. NULL generally refers to the value representing a NULL pointer, which may or may not actually be zero (though a zero has to act as a NULL in a pointer context). The value, 0, for a char is referred to as a nul, or as '\0', to reduce confusion.

Your example code uses a lot of stuff you haven't bothered to define in our sight. Since we only read minds on every other Wednesday, that's not too effective.