InterviewSolution
| 1. |
Why Does Not The Following Statement Work? Char Str[ ] = Hello ; Strcat ( Str, ! ) ; |
|
Answer» The string function strcat( ) concatenates STRINGS and not a CHARACTER. The basic DIFFERENCE between a string and a character is that a string is a collection of characters, represented by an array of characters whereas a character is a single character. To make the above statement work writes the statement as SHOWN below: strcat ( STR, ! ) ; The string function strcat( ) concatenates strings and not a character. The basic difference between a string and a character is that a string is a collection of characters, represented by an array of characters whereas a character is a single character. To make the above statement work writes the statement as shown below: strcat ( str, ! ) ; |
|