From a26f2837166f7232d13322e013883ed003d46f27 Mon Sep 17 00:00:00 2001 From: EliteTK Date: Thu, 10 Jul 2014 22:35:21 +0100 Subject: More stuff. --- structest.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 structest.c (limited to 'structest.c') diff --git a/structest.c b/structest.c new file mode 100644 index 0000000..28888e5 --- /dev/null +++ b/structest.c @@ -0,0 +1,19 @@ +#include +#include + +struct test { + char *string; + int length; +}; + +int main(int argc, char **argv) +{ + struct test t = {"Testing.", strlen("Testing.")}; + + char strbuf[256]; + + strncpy(strbuf, t.string, t.length + 1); + printf("%s\n", strbuf); + + return 0; +} -- cgit v1.2.3-54-g00ecf