Question: In C language: (1)Using Design by Contract, update the following to be robust and reliable char * concat( const char * s1, const char *
In C language:
(1)Using Design by Contract, update the following to be robust and reliable
char * concat( const char * s1, const char * s2 ) {
char * result = malloc( strlen( s1 ) + strlen( s2 ) + 1);
strcpy( result, s1 );
strcat( result, s2 );
return result; // caller has to free later
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
