every int declaration was moved outside a function as declarations outside functions are implicitly ints.
same for the function c and main, we don't have to declare them as int.
the variable c was renamed to d to avoid conflicts with the function
fh was renamed f because it's shorter
the char f[] in the function c was changed to a char*f, which is shorter and we can do that without danger since we do not edit it.
if(f[m+++1]=='\0') is equivalent to if(f[m+++1]==0) and subsequently to if(!f[m+++1])
Additional notes:
a lot of variables are declared but not initialised and then used with ++, this could cause some problems with some specific compilers but everything works well with both clang 14 and gcc 11.3 here
i can't declare l as an int[] because fgets disagrees
there is probably a way to optimise more by replacing the ifs with ternary operators but i'm too lazy to do that
oh yeah i forgot to mention but all this saves a whopping 33 characters.
I could've saved more space by removing the spaces in the printf but didn't want to
changelog:
int
declaration was moved outside a function as declarations outside functions are implicitlyint
s.c
andmain
, we don't have to declare them asint
.c
was renamed tod
to avoid conflicts with the functionfh
was renamedf
because it's shorterf[]
in the functionc
was changed to achar*f
, which is shorter and we can do that without danger since we do not edit it.if(f[m+++1]=='\0')
is equivalent toif(f[m+++1]==0)
and subsequently toif(!f[m+++1])
Additional notes:
++
, this could cause some problems with some specific compilers but everything works well with both clang 14 and gcc 11.3 herel
as anint[]
becausefgets
disagreesif
s with ternary operators but i'm too lazy to do that