cpp_references
Description
Use C++ references to define the character pointer char *p in the main function, then malloc to request space (size 100 bytes) within the subfunction, read the string via fgets(), and finally output it in the main function; note: you must use C++ References in the subfunction, and to read the string from standard input in C++, you need to use fgets(p,100,stdin).
Input
Enter a string, such as I love C language.
Output
If the input is I love C language, then the output is I love C language.
Solution
1 |
|