C – The %x format specifier
Break-down: 8 says that you want to show 8 digits 0 that you want to prefix with 0‘s instead of just blank spaces x that you want to print in lower-case hexadecimal. Quick example (thanks to Grijesh Chauhan): Output: Also see http://www.cplusplus.com/reference/cstdio/printf/ for reference.