incompatible types of assignment of ‘const char [2] to char [1]’

In addition to the problem with this code that’s pointed out in other answers, I’ll also point out that if the input is anything other than an empty string, this results in memory corruption and undefined behavior.

char opinion1[1]

A one character array only accomodates an empty string…

cin>>opinion1;

… and as soon as one character is entered here, this will overflow the array buffer, corrupt the stack, and result in undefined behavior.

Leave a Comment