如何将unsigned char *值复制到unsigned char? [英] How to Copy unsigned char* value to unsigned char?
本文介绍了如何将unsigned char *值复制到unsigned char?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将unsigned char *值复制到unsigned char ???
How to Copy unsigned char* value to unsigned char???
推荐答案
您是否在问如何这样做:
Are you asking how you do this:
void GetChar(unsigned char *pointer)
{
unsigned char uc = *pointer;
}
因为如果您愿意,我认为您需要更仔细地阅读课程笔记...
Because if you are, I think you need to look at your course notes a little more carefully...
Gokulnath007写道:
Gokulnath007 wrote:
是的.要迭代.
好吧,指针基本上是一个数组(相反,数组基本上是一个指针).
字符串是字符数组,后跟空字符''\0''
.
所以,
Well, a pointer is basically an array (rather, an array is basically a pointer).
A string is an array of characters followed by the null character ''\0''
.
so,
char *str = "hello world";
for (int ch = 0; str[ch] != ''\0''; ++ch) { //keep going until we hit the ''\0''
printf("%c\n", str[ch]); //print a single character and jump to the next line
}
这篇关于如何将unsigned char *值复制到unsigned char?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文