GMgKe586q6suSQnyqZLlGCooeWM

Pages

Search

Tuesday, March 15, 2011

C - strncpy

/**
 * This copy n character of the string
 * strncpy(destination, source, n characters)
 */

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

#define N 20

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

    char *data = malloc(sizeof(char));
    strncpy(data,"Indonesia is full countries",10);
    puts(data);

    return 0;
}

Share/Bookmark

No comments:

Post a Comment