Can I make a function like string find (string number1, string number2) in c++?

Asked 2 years ago, Updated 2 years ago, 55 views

In c++, string find (string num1, string num2) I'm going to make a function called find, but can I use the return type as a string?

c++ string function

2022-09-22 09:00

1 Answers

The basic types of functions are as follows.

[Return type] [Function name] ([Factor 1], [Factor 2]...);

Return type means return type, i.e.

return e;

It represents the data type of the return value that will go into 에. Typical data types include int float double char.

Questioner is

string find (string num1, string num2) {

    strcat(num1, num2);

    return num1;
}


I think you want a function similar to... The return type is already string, but I don't understand what you're changing.


2022-09-22 09:00

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.