diff options
author | EliteTK <tomasz.kramkowski@gmail.com> | 2014-07-10 22:35:21 +0100 |
---|---|---|
committer | EliteTK <tomasz.kramkowski@gmail.com> | 2014-07-10 22:35:21 +0100 |
commit | a26f2837166f7232d13322e013883ed003d46f27 (patch) | |
tree | 7c91d3328883cc544ed74acb1d10ac6e81c1b0e0 /structest.c | |
parent | 39c3721ca16d2dfdbd8e5488e7d1f57a6d54310e (diff) | |
download | c-stuff-a26f2837166f7232d13322e013883ed003d46f27.tar.gz c-stuff-a26f2837166f7232d13322e013883ed003d46f27.tar.xz c-stuff-a26f2837166f7232d13322e013883ed003d46f27.zip |
More stuff.
Diffstat (limited to 'structest.c')
-rw-r--r-- | structest.c | 19 |
1 files changed, 19 insertions, 0 deletions
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 <stdio.h> +#include <string.h> + +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; +} |