Hi all, trying to read up on C to get acquainted with the language. Got an exercise am trying to answer and i may need your help to know if am right. I have this code as below, and am asked, what lines have buffer length checking errors.
int main( void ) {
char[20] in = gets();
char[20] in2 = gets();
char[39] out;
strcpy(out,in);
int index = strlen(in);
while(index < 39) {
out[index] = in2[index-strlen(in)];
index = index + 1;
}
return 0;
}
From my reading and research so far, line 5 seems to me like the line with an error. My reason is that it does not specify the length to be copied. ( in a lay man's english). I cant say for sure if am right but may need your help and also corrections on the code.
Thanks