Please don't forget to edit the strings before compiling.
#include <stdio.h>
static int idx = 0;
#define SIZE 1000
char* my_str_n_cat(char* d, char* s, int n) {
while (*d!='\0') {
d++;
}
while (*s!='\0' && idx<n) {
*d = *s;
d++; s++; idx++;
}
*d='\0';
return d;
}
int main() {
char string[SIZE] = "First+";
char* string_2 = "Second";
int tmp; printf("Enter amount: "); scanf("%d",&tmp);
my_str_n_cat(string, string_2, tmp);
printf("\\%s\\",string);
return 0;
}