Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int str_n_cat(char dest[], char str1[], int n)
- {
- for(int i=0;i<n;i++)
- {
- strcat(dest, str1);
- }
- puts(dest);
- return 0;
- }
- int main(void){
- char vetor[150];
- char vetor2[150];
- int n;
- printf("digite a primeira e a segunda strings, em seguida quantas vezes quer concatenar: \n");
- fgets(vetor,150,stdin);
- vetor[strlen(vetor)-1] = '\0';
- fgets(vetor2,150,stdin);
- vetor2[strlen(vetor2)-1] = '\0';
- scanf("%d", &n);
- str_n_cat(vetor, vetor2, n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement