0

I just figured out that to have a string as a return value of a method it needs to be written like this:

const char* doSomething();

However, when a an array of chars (String) is initalized, it is written like this:

char something [] = "...";

Also, saving the return value of a method that returns a string would also have to look like this:

const char*s=doSomething();

Why is that? What is the difference between char[] and char* in this context? I know that char* is a pointer but why can it be used as a real variable in this case?

sin010
  • 15
  • 5

0 Answers0