This question already has an answer here:
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.
system()
orexecve()
? – muru Nov 2 '17 at 9:41