Question: Below lines implement a function that takes two char arrays of size 5 and copies the chars from one array to the other; and the
Below lines implement a function that takes two char arrays of size 5 and copies the chars from one array to the other; and the main program that calls the function. Corrections in which lines are necessary so that this function works properly? Select all that apply.
1 #include (stdio.h)
2 char CopyString(char dest, char src)
3 {
4 for (char i=0; i<5; i++)
5 {
6 dest[i] = src[i];
7 }
8 }
9
10 int main
11 {
12 char A = Hello";
13 char B[5];
14 CopyString(A);
15 for (int i=0; i<5; i++)
16 {
17 printf( %c , B[i] );
18 }
19 }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
