Skip to content

Commit 3c95239

Browse files
committed
Use PRI[ud]64 format specifier for portability
PRIu64 is a format specifier, introduced in C99, for printing uint64_t, where uint64_t is unsigned integer type with width of ... 64 bits respectively (provided only if the implementation directly supports the type).
1 parent 636970d commit 3c95239

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/nqueens.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* source: https://computerpuzzle.net/english/nqueens/
33
*/
44

5+
#include <inttypes.h>
56
#include <stdint.h>
67
#include <stdio.h>
78

@@ -166,7 +167,7 @@ int main(void)
166167
printf(" N: Total Unique\n");
167168
for (int size = 2; size <= MAXSIZE; size++) {
168169
nqueens(size);
169-
printf("%2d:%13lld%13lld\n", size,
170+
printf("%2d:%13" PRId64 "%13" PRId64 "\n", size,
170171
count8 * 8 + count4 * 4 + count2 * 2 /* total solutions */,
171172
count8 + count4 + count2 /* unique solutions */);
172173
}

0 commit comments

Comments
 (0)