inttypes


1. Converting Signed Integer to String

#include <inttypes.h>
#include <stdio.h>

int main() {
  int64_t num = -123456789;
  char buffer[32];
  sprintf(buffer, "%" PRIi64, num);
  printf("Signed integer as a string: %s\n", buffer);
  return 0;
}

2. Converting Unsigned Integer to String

#include <inttypes.h>
#include <stdio.h>

int main() {
  uint64_t num = 123456789;
  char buffer[32];
  sprintf(buffer, "%" PRIu64, num);
  printf("Unsigned integer as a string: %s\n", buffer);
  return 0;
}

3. Reading Signed Integer from String

4. Reading Unsigned Integer from String

5. Maximum and Minimum Values of Integer Types

6. Size of Integer Types

7. Formatting Signed Integer with Commas

8. Formatting Unsigned Integer with Commas

9. Reading Fixed-Width Integer from File

10. Writing Fixed-Width Integer to File

11. Reading Hexadecimal Integer from String

12. Writing Hexadecimal Integer to String

13. Reading Octal Integer from String

14. Writing Octal Integer to String

15. Reading Binary Integer from String

16. Writing Binary Integer to String

17. Converting Floating-Point Number to Fixed-Point Integer

18. Converting Fixed-Point Integer to Floating-Point Number

19. Saturating Arithmetic