I finally figured it out. Sorry, it took me a while. I am not a C developer. But anyways, I have the answer in video format. Check it out. I also included the code down below in case you don't want to watch the video version and just want the answer.
Let me know if you have any questions or if I can be of further help.