'Continue a stopped foreground process in background in c

I am working on a uni project, we are meant to implement our own shell. So I got to the task to mimic the ctrl-z, fg, bg, kill features. I am now trying to implement bg command, it works in the same way as the built-in bg command. For fg, did this:

void fg(char** fgInput){

  if(fgInput[1]==NULL){
    kill(globalForeground[foregroundCount-2],SIGCONT);
  }else{
    int pid = atoi(fgInput[1]);
    kill(globalForeground[pid-1],SIGCONT);
  }
}```

I was wondering if I could do something similar like signaling to continue a stopped foreground process in the background? 
Thanks in advance


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source