c++ – Invalid conversion from const char* to char error

c++ – Invalid conversion from const char* to char error

You should be using single quotes for characters. Double quotes means youre using a (potentially single-character) string literal, which is represented as a const char * (pointer to constant character).

Correct syntax: circle1.symbol = *;

The problem is here:

circle1.symbol = *;

circle1.symbol is defined as char, but you assign a string to it (an array of chars). What you need to do is

circle1.symbol = *;

c++ – Invalid conversion from const char* to char error

Your definition of Circle says that symbol is a char, yet you try to assign it a string literal of type char[2]:

circle1.symbol = *;

Instead, you should be assigning it a char:

circle1.symbol = *;

Leave a Reply

Your email address will not be published.