Can someone explain this to me Multiple choice For each of t
Solution
Here we will first see what all variable and array are present to hold te values
int i ; variable to loop through
char s1[20] //first char array to store values and size is 20
char s2[20] //second char array to store values and size is 20
strcpy(s1,\"xo\");
strcpy(s2,\"xx\");
//strcpy functions copies the data into destination so here s1 will have xo and s2 will have xx.
and function strcat used below is the function where the destintion parameter will have the concatenated value of destination and source string.
the loop defined will concatenate s2 value to s1 and when i>1 it will assign o to s2[0]. Now we will see iterations and value modification through a table.
I
S1
S2
strcat[s1,s2,]
i>1
S2[0]=o
S1
S2
0
xo
xx
xoxx
F
Xoxx
xx
1
xoxx
xx
xoxxxx
F
xoxxxx
xx
2
xoxxxx
xx
xoxxxxxx
T
ox
xoxxxxxx
ox
3
xoxxxxxx
ox
xoxxxxxxox
T
ox
xoxxxxxxox
ox
| I | S1 | S2 | strcat[s1,s2,] | i>1 | S2[0]=o | S1 | S2 |
| 0 | xo | xx | xoxx | F | Xoxx | xx | |
| 1 | xoxx | xx | xoxxxx | F | xoxxxx | xx | |
| 2 | xoxxxx | xx | xoxxxxxx | T | ox | xoxxxxxx | ox |
| 3 | xoxxxxxx | ox | xoxxxxxxox | T | ox | xoxxxxxxox | ox |

