Use of strings in functions

  • Thread starter Thread starter Rico_069
  • Start date Start date
R

Rico_069

Guest
I have the following function call:

foo("Hello");

Visual Studio 2017 gives a compile error that says "error C2664" and "cannot convert to char[]".

The code only works as follows:

char sString[] = "Hello";
foo(sString);

Is there any way to get the compiler to accept the former code up above, where I just use foo("Hello")??

Thanks! - Robert

Continue reading...
 
Back
Top