So use the debugger and find out what the value is: the error message is pretty explicit:
variable length array bound evaluates to non-positive value
So d is zero or negative, which means that
atoi
returned that. so what is in
argv[0]
that evaluates to zero or a negative number?
Hint: the first parameter of a C application runtime arguments is the application exe name...