Refactoring for best practices
This commit is contained in:
parent
2d0b19ccf1
commit
c03cc73acf
2
Makefile
2
Makefile
@ -1,5 +1,5 @@
|
|||||||
subnetcalc: subnetcalc.c
|
subnetcalc: subnetcalc.c
|
||||||
gcc subnetcalc.c -lm -o subnetcalc
|
gcc -Wall -pedantic subnetcalc.c -lm -o subnetcalc
|
||||||
|
|
||||||
clean: subnetcalc
|
clean: subnetcalc
|
||||||
rm subnetcalc
|
rm subnetcalc
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
main()
|
int main(void)
|
||||||
{
|
{
|
||||||
int net;
|
int net;
|
||||||
double hosts;
|
double hosts;
|
||||||
double addr;
|
double addr;
|
||||||
printf("Enter netmask in slash-notation without the slash: ");
|
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
|
if (net >= 0 && net <= 32) // Sanity check the user input
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user