Anonymous asked in Computers & InternetProgramming & Design · 1 month ago

struct c++ programming?

i have used class before, but i don't know struct, could I know how to solve the error?


the error is coming from the last part, i cannot return the value.

Attachment image

1 Answer

  • 1 month ago
    Favorite Answer

    The error messages tell you exactly what you're doing wrong.  You defined a function that returns a Result struct, and the final line in that function does not return a Result struct.  It returns an integer.  Either change that return line to "return a;" or change the function definition to "int longestSubstring".  That's what the language requires.

Still have questions? Get your answers by asking now.