将字符串数组转换为char * [英] convert a string array into a char *
本文介绍了将字符串数组转换为char *的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
我怎样才能将字符串数组转换为char *(在C ++中)?
问候。
hello
how can i convert a string array such as: char mobilenumber[80], into a char * (in C++)?
Regards.
推荐答案
尝试:
char mobilenumber[80];
....
char* myPointer = mobilenumber;
甚至:
Or even:
char* myPointer = &(mobilenumber[0]);
要将数组传递给接受char *
的函数,只需传递mobilenumber
喜欢 -
To pass the array to a function that accepts achar*
simply passmobilenumber
like -
int foo(char* number);
foo(mobilenumber);
这篇关于将字符串数组转换为char *的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文