From b95730410bd07883895295bd7e1192cdaeb2d6bd Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Sun, 19 Jun 2011 07:45:12 -0400 Subject: [PATCH] futzing with printf return --- gowrikumar/src/10-nestedprintf.c | 15 +++++++++++++++ gowrikumar/src/10b-nestedprintf.c | 17 +++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 gowrikumar/src/10-nestedprintf.c create mode 100644 gowrikumar/src/10b-nestedprintf.c diff --git a/gowrikumar/src/10-nestedprintf.c b/gowrikumar/src/10-nestedprintf.c new file mode 100644 index 0000000..857741c --- /dev/null +++ b/gowrikumar/src/10-nestedprintf.c @@ -0,0 +1,15 @@ +/** + * :author: Dan Buch (daniel.buch@gmail.com) + */ + +#include + +int main() +{ + int i = 43; + printf("%d\n", printf("%d", printf("%d", i))); + return 0; +} + +/* vim:filetype=c:fileencoding=utf-8 + */ diff --git a/gowrikumar/src/10b-nestedprintf.c b/gowrikumar/src/10b-nestedprintf.c new file mode 100644 index 0000000..0e0304d --- /dev/null +++ b/gowrikumar/src/10b-nestedprintf.c @@ -0,0 +1,17 @@ +/** + * :author: Dan Buch (daniel.buch@gmail.com) + */ + +#include + +int main() +{ + int i = 43, nprinted; + nprinted = printf("%d\n", printf("%d", printf("%d", i))); + nprinted = printf("(the last one was %d characters)\n", nprinted); + nprinted = printf("(and that was %d characters)\n", nprinted); + return 0; +} + +/* vim:filetype=c:fileencoding=utf-8 + */