简体   繁体   English

需要使用指针和结构作为增量操作数的左值

[英]lvalue required as increment operand using pointers and struct

May I know whats wrong? 我可以知道怎么了吗?

for ( ; *line[0]; ++line[0], ++p->title) p->title = tolower(*line[0]);

p is a struct and title is a char pointer, line is a string/char pointer p是一个结构,title是一个char指针,line是一个字符串/ char指针

typedef struct p{
    char *title;
} p;

I'm trying to convert the string to all lower case. 我正在尝试将字符串转换为所有小写字母。

You are using p as a pointer to a struct. 您正在使用p作为指向结构的指针。 If you need title you should use the period operator like this: 如果需要标题,则应使用句点运算符,如下所示:

p.title

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

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