简体   繁体   English

传递Const char的值是什么*

[英]What value to pass Const char*

I am absolute beginner for c++ running through some code and faced below code 我是运行某些代码并面对以下代码的c ++的绝对初学者

bool SomeFunction (const char* x, char* y, int z)
{
   //some code
}

now i want to pass value to the arguments for the above method 现在我想将值传递给上述方法的参数

how to pass value to const char* X argument ? 如何将值传递给const char * X参数?

and I am not understanding what is this ? 我不明白这是什么吗? is this pointer to char ? 这是char的指针吗?

Thanks 谢谢

const char* is indeed a point to a char . const char*确实指向char However, since strings are no more than a char array with a \\0 at the end, this is usually used to pass strings: 但是,由于字符串只不过是一个以\\0结尾的char数组,因此通常用于传递字符串:

SomeFunction ("hello", "world", 12);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM