简体   繁体   中英

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

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. If you need title you should use the period operator like this:

p.title

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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