1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
int main(int argc, char* argv[]) {
// one argument
printf("One\n");
// two arguments
printf("One %d\n", 2);
// three arguments
printf("One %d %s\n", 2, "3");
// four argurments
printf("One %d %s %c\n", 2, "3", '4');
// five argurments
printf("One %d %s %c %x\n", 2, "3", '4', 5); // %x is for hexadecimal representation
// six argurments
printf("One %d %s %c %x %o\n", 2, "3", '4', 5, 6); // %o is for octal representation
// WARNING: printf(…) does not print the prefix for %x and %o.
// mintf(…) does print the prefix for %x.
// mintf(…) does not support %o.
// printf(…) does not support %b (binary). # at least not in ISO C11.
return EXIT_SUCCESS;
}
// TRIVIA
// view header file: gf (normal mode, while cursor is on filename)
// :e# to get back to previous file.
/* vim: set tabstop=4 shiftwidth=4 fileencoding=utf-8 noexpandtab: */
|
© Copyright 2022 Alexander J. Quinn This content is protected and may not be shared, uploaded, or distributed.