[Error] ISO C++ forbids comparison between pointer and integer [-fpermissive] code example

Example 1: c++ forbids comparison between pointer and integer

char a[2] defines an array of char's. a is a pointer to the memory at 
  the beginning of the array and using == won't actually compare the 
  contents of a with 'ab' because they aren't actually the same types,
  'ab' is integer type. Also 'ab' should be "ab" otherwise you'll have 
  problems here too. To compare arrays of char you'd want to use strcmp.

Something that might be illustrative is looking at the typeid of 'ab':

Example 2: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] if(s[i] != "b"){

if (response == 'Y')

Tags:

Cpp Example