Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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':
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #forbids #comparison #pointer #integer
ADD COMMENT
Topic
Name
3+4 =