Here is my c code snippet from test.c.
printf("ruid:%d, euid:%d\n",getuid(),geteuid());
char *args[] = {"/bin/bash","-c","exec id",0};
execv("/bin/bash",args);
I compile the code with sudo gcc test.c -o test; sudo chmod +s ./test, so program test has suid bit and is owned by root.
printf outputs as espected, ruid:1000, euid:0, but the program id indicates ruid and euid are both 1000.