Unused variables removed
Reducing scope
Preincrement/decrement instead of postincrement/decrement
strncpy() '/0' terminated
sscanf() to prevent overflow