Switch network interface back to auto/dynamic IP address using C/C++ Linux
There are tons of examples in the Internet about how to set a Static IP address to a network interface under Linux using C language.
One of the most popular is How to set the IP address from C in linux