what does ++operator do in this void uart_puts(unsigned char
what does ++operator do in this void uart_puts(unsigned char * t) { while(*t) uart_putch(*t++);
++
算子在这个C程序中做什么?
void uart_puts(unsigned char *t) {
while (*t)
uart_putch(*t++); //I cant understand the operation here
}
指针算术:
句子uart_putch(*t++)可以分解为:
uart_putch(*t); // get actual t unsigned char value
t++; // increments t pointer to next unsigned char
*t
//包含它所指向的变量的地址 *t++
//递增到下一个位置
如:-
int j;
int *k;
k=&j; //assigning k to j's address, so that k pointing the value of j
*k++;//means incrementing the adress to point next
相关文章:
- 从"int*"强制转换为"unsigned int"会丢失精度错误
- 不能在初始值设定项列表中将非常量表达式从类型 'int' 缩小到'unsigned long long'
- <Windows>为什么 std::thread::native_handle 返回类型为"long long unsigned int"的值,而不是 void*(又名 HANDLE)?
- 错误:隐式转换更改符号:'int'到'unsigned long'
- 如何使用多次 memcpy 转换回 std::vector<unsigned char>?
- 定义 uint= "unsigned int" 没有像我在 Visual Studio 中使用 nvcc 时预期的那样应用
- static_cast<unsigned>(签名)与标准::bit_cast<unsigned>(签名)之间有区别吗?
- 对 '(const Y) (int&, std::mersenne_twister_engine<long unsigned int,
- 错误:从'void*'到'const uint8_t* {aka const unsigned char*}'的转换无效 [-允许]
- 错误:'class std::unique_ptr<std::set<long unsigned int> >'没有名为 'size' 的成员
- 为什么在C++负数static_cast如果<unsigned>数字是常数,则不同
- 正确语法,用于统一初始化名称中带有空格的类型的临时,如unsigned int
- "1L << count"是什么意思?如何使用超出"unsigned long long int? "范围的语句编号打印?
- C++ - 从 "int" 到 "unsigned char" 的缩小转换无效
- 让 'std::vector<unsigned char>' 从 'std::string' 中窃取内存
- C++11 模板函数"implicity"将位集<N>转换为"unsigned long"
- "runtime error: addition of unsigned offset to 0x129000a0 overflowed to 0x12900088"
- 按值对 std::unordered_map<std:::string, std::atomic<unsigned int>> 进行排序
- 无法从'unsigned short [9]'转换为'char []'
- 编译Qt项目给出了对运算符delete(void*,unsigned int)的未定义引用