const char code[] = "\x31\xc0";
int main(){
((void(*)( ))code)();
}
Here's how it works. The code variable will decay to the address of the first element (\x31).
That address will then be cast to the address of a function taking indeterminate arguments, and returning nothing.
That covers the entire ((void(*)( ))code) bit and, up to there, you've basically constructed a function pointer pointing to your string.
The () then simply calls the function that you're pointing to.
If that's an Intel CPU you're targeting, 31 c0 disassembles to xor eax, eax but I'm not expecting much joy when it runs off the end of the buffer, it's likely to crash spectacularly. The \x00 marking the end of the string is the first bit of an add instruction but, as to what comes after that, there's no guarantee.
Adding a ret instruction to the end of the string may make it safer but you may have to examine the generated assembler code for the call itself to figure out which ret should be used.