Reply to Re: sprintf is molesting
If you don't have an account, just leave the password field blank.
The purpose of sprintf is to write formatted output to a buffer. That buffer, in this case, is crap. The next argument to sprintf determines the type of the next argument...the most common are %s, string, and %d, integer. Since spr[h].damage is of type int, %d should be used.
The function essentially does exactly what printf does, except captures the STDIO output and puts it into the buffer. So, sprintf is converting the value of spr[h].damage to a string and storing it in crap. Redink's example is correct.
The function essentially does exactly what printf does, except captures the STDIO output and puts it into the buffer. So, sprintf is converting the value of spr[h].damage to a string and storing it in crap. Redink's example is correct.