C program to get IP address

Created with Sketch.


C program to get IP address

C program to print IP (Internet Protocol) address of your computer, system function is used to execute the command “ipconfig” which prints IP address, subnet mask, and default gateway. The code given below works for Windows XP and Windows 7. If you are using Turbo C compiler then execute this program from the folder, it may not work when you are working in a compiler and trying to run it by Ctrl + F9.

C programming code


int main()

return 0;


The output of the program: (In Windows 7)
IP address C program output

Only a part of the output is shown in the image.

Leave a Reply

Your email address will not be published. Required fields are marked *