basically im building a port scanner of sorts (well technically it piggy-backs another ports-canner but thats not important). The problem lies within the code in which the user inputs the target IP address to be scanned. The program runs smoothly until it returns a 'segmentation fault: 11' error after the user inputs the IP address.
I have done some research into segmentation faults and i believe that this particular error is thanks to the fact that my code has declared the targetIP
variable as a char, yet contains numbers with multiple '.'s as you would need for an IP address.
So my question is, what variable type will i need that can handle numbers with multiple '.'s? eg: 225.1.1.24
code:
char *target_IP;
scanf("%s",target_IP);
// segmentation fault occurs here so bellow printf is never displayed vv
printf("\nWriting target IP [%s] to file\n",target_IP);