diff --git a/Makefile b/Makefile index ac6b05b..6e1816b 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ subnetcalc: subnetcalc.c - gcc subnetcalc.c -lm -o subnetcalc + gcc -Wall -pedantic subnetcalc.c -lm -o subnetcalc clean: subnetcalc rm subnetcalc diff --git a/subnetcalc.c b/subnetcalc.c index 838157a..68135c9 100644 --- a/subnetcalc.c +++ b/subnetcalc.c @@ -6,13 +6,13 @@ #include #include -main() +int main(void) { int net; double hosts; double addr; printf("Enter netmask in slash-notation without the slash: "); - scanf("%d", &net); + scanf("%2d", &net); if (net >= 0 && net <= 32) // Sanity check the user input {