Search
 
SCRIPT & CODE EXAMPLE
 

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':
Comment

PREVIOUS NEXT
Code Example
Cpp :: how to sort array in c++ 
Cpp :: substring in c++ 
Cpp :: toString method in c++ using sstream 
Cpp :: CRED Coins codechef solution in c++ 
Cpp :: prevent getting data from data-tooltip-content tippyjs 
Cpp :: how to copy vector to another vector in c++ 
Cpp :: fill vector with zeros c++ 
Cpp :: get std string from file 
Cpp :: one dimensiol array to two dimen c++ 
Cpp :: Lambda capture as const cpp 
Cpp :: program to swap max and min in matrix 
Cpp :: if argv == string 
Cpp :: c++ comment out multiple lines 
Cpp :: iterate const vector 
Cpp :: volumeof a sphere 
Cpp :: Ninja c++ 
Cpp :: array 2d to 1d 
Cpp :: c++ include < vs "" 
Cpp :: how can I delete a substring from a string in c++? 
Cpp :: pointers c++ 
Cpp :: dangling pointer in cpp 
Cpp :: C++ function inside main 
Cpp :: enum in c++ 
Cpp :: cpp foreach 
Cpp :: auto in cpp 
Cpp :: Round 1 Confusion codechef solution in c++ 
Cpp :: Common elements gfg in c++ 
Cpp :: COs trigonometric function 
Cpp :: c++ anti debugging 
Cpp :: pointer in cpp details 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =