Computer Science, asked by MrSinister07, 6 months ago

Consider the following code. The function myStrcat concatenates two strings. It appends all characters of b to the end of a. So the expected output is "PRO coder". The program compiles fine but produces segmentation fault when run.

#include
void myStrcat(char *a, char *b)
{ int m = strlen(a); int n = strlen(b);
int i;
for (i = 0; i <= n; i++)
a[m+i] = b[i];
} int main()
{ char *str1 = "PRO ";
char *str2 = "coder";
myStrcat(str1, str2);
printf("%s ", str1);
return 0; }
Which of the following changes can correct the program so that it prints "PRO coder"?

Answers

Answered by pratyush15899
8

Answer:

the corrct ans is:

odd

hope it helps

Answered by Anonymous
3

Answer:

Odd

Odd is correct answer

Similar questions