GMgKe586q6suSQnyqZLlGCooeWM

Pages

Search

Tuesday, March 15, 2011

C - gets And malloc

#include <stdio.h>
#include <stdlib.h>


int main()
{
    system("color 2f");

    char *msg = malloc(sizeof(char));
    gets(msg);
    printf("%s",&msg);

    // you can also use array of char
    char name[2];
    gets(name);
    puts(name);

    return 0;
}

Share/Bookmark

No comments:

Post a Comment