aboutsummaryrefslogtreecommitdiffstats
path: root/allocing.c
blob: af19dab62d133cd9aff0483b380c278f6871169b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;
}