aboutsummaryrefslogtreecommitdiffstats
path: root/allocing.c
diff options
context:
space:
mode:
authorEliteTK <tomasz.kramkowski@gmail.com>2014-02-24 21:03:53 +0000
committerEliteTK <tomasz.kramkowski@gmail.com>2014-02-24 21:03:53 +0000
commitbe9d9aedb53e9b3211765f16bf4b90f5d31c1722 (patch)
treef9368e8a880abf9b9392d631da1e5a373c23dc7e /allocing.c
parentde4075f451a2d6e457dbf9dff714d166618c4495 (diff)
downloadc-stuff-be9d9aedb53e9b3211765f16bf4b90f5d31c1722.tar.gz
c-stuff-be9d9aedb53e9b3211765f16bf4b90f5d31c1722.tar.xz
c-stuff-be9d9aedb53e9b3211765f16bf4b90f5d31c1722.zip
Added all files
Diffstat (limited to 'allocing.c')
-rw-r--r--allocing.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/allocing.c b/allocing.c
new file mode 100644
index 0000000..af19dab
--- /dev/null
+++ b/allocing.c
@@ -0,0 +1,19 @@
+#include<stdio.h>
+#include<stdlib.h>
+
+int main(int argc, char *argv[] ) {
+ // malloc test
+ char * string;
+ string = (char *) malloc(10 * sizeof(char));
+
+ *(string + 0) = 'a';
+ *(string + 1) = 'b';
+ *(string + 2) = 'c';
+ *(string + 3) = '\n';
+ *(string + 4) = '\0';
+
+ printf("%s", string);
+
+ free(string);
+ string = NULL;
+}