Refactoring for best practices

This commit is contained in:
Jack-Benny Persson 2020-05-02 14:34:28 +02:00
parent 2d0b19ccf1
commit c03cc73acf
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -6,13 +6,13 @@
#include <stdio.h>
#include <math.h>
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
{