In C language:
Given the string variables name1 and name2, write a fragment ofcode that assigns the larger of the two to the variable first(assume all three are already declared and name1 and name2 assignedvalues ).
Answer
// assuming all three are already declared and name1 and name2 are assigned valuesif (strlen(name1) > strlen(name2)) { strcpy(first, name1);} else { strcpy(first, name2);}