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
8
Answer:
the corrct ans is:
odd
hope it helps
Answered by
3
Answer:
Odd
Odd is correct answer
Similar questions
Social Sciences,
2 months ago
History,
2 months ago
Math,
2 months ago
Science,
11 months ago
Math,
11 months ago