C/string.h/strncpy — различия между версиями
Admin (обсуждение | вклад) м (1 версия: Импорт контента...) |
Admin (обсуждение | вклад) м (1 версия: Импорт контента...) |
(нет различий)
|
Текущая версия на 10:22, 25 мая 2010
strncpy: copies up to count characters from *str2 to *str1
//Declaration: char *strncpy(char *str1, const char *str2, size_t count);
//Return: returns a pointer to str1.
#include<stdio.h>
#include<string.h>
int main(void){
char str1[128], str2[80];
gets(str1);
strncpy(str2, str1, 79);
printf("%s",str2);
}
/*
2
2*/