In fact you can do smth like this:
Code:
#include <stdio.h>
#include <string.h>
#define MIN(a,b) ((a)<(b)) ? a:b;
void movefunction(char m1[], char m2[], int n);
int main()
{
char m1[1000];
char m2[1000];
int n;
printf("write string 1 \n");
scanf("%s", m1);
printf("write string 2 \n");
scanf("%s",m2);
printf("write the number of bytes to move\n");
scanf("%d",&n);
movefunction(m1, m2, n);
printf("%s", m1);
return 0;
}
void movefunction(char *s1, char *s2, int n){
int i,move;
move=MIN(strlen(s1),n);
move=MIN(strlen(s2),move);
for (i=0; i<move; i++,s1++,s2++)
*s1 = *s2;
}
So you will use pointers and you will not run out of strings lengths