Getting process information in C or C++

I am trying to do a small project where I want to display all the processes and the time since they have been active, like the activity monitor, but in a terminal built with C or C++ (probably C). I am new to this application development, and I don't know where to begin. It would be really helpful if you could give me some guides, links, or materials on where I can read them and proceed further. Thanks

Looks like you could do it using the sysctl function, as in this code: https://gist.github.com/s4y/1173880/9ea0ed9b8a55c23f10ecb67ce288e09f08d9d1e5

Getting process information in C or C++
 
 
Q