Add New user and password with sudo permission in Linux using programmatically in C or C++ language.

Exist solution like How can I add a new user as sudoer using the command line? ,In this case you need terminal but in my case it daemon process and i want do with programmatically in c or C++ language.

Note:- Deamon application so there is no user interface to set password manually.