简体   繁体   English

(char *)和char *之间有什么区别?

[英]What is the difference between (char*) and char*?

in the line: ((string*)userp)->append((char*)contents, size * nmemb); 在行中: ((string*)userp)->append((char*)contents, size * nmemb); Why use (char*) or (string*) as opposed to char* or string ? 为什么使用(char*)(string*)而不是char*string Trying to use char* or string results in an error Also, what does the operator -> do? 尝试使用char*string导致错误另外,运算符->做什么? It seems like it is just taking the place of str.append(var, pos); 看起来它只是取代了str.append(var, pos);

(string*) is a cast to pointer to string and string is a class string. (string *)是指向字符串的指针,字符串是类字符串。 (char*) is a cast to pointer to char and char* is a pointer to char. (char *)是指向char的指针,char *是指向char的指针。 the -> operator accesses the attributes or methods of a pointer to a class - >运算符访问指向类的指针的属性或方法

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

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