strncpy - Copies up to count characters from str2 to str1 in C


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

int main(void){
  char str1[128], str2[80];

  gets(str1);
  strncpy(str2, str1, 79);

  printf("%s",str2);
}



Output:
2
2