my problem is how to use if else statement with the use of character type string (char str[40]) for exemple
char str[30];
cin>>str; or gets(str) or getline(str,30)
if(str=="hello") cout<<"world";
i search this everywhere but every answer could not satisfied me.
moaz.amin.37
-12
Junior Poster
Recommended Answers
Jump to PostIn this case, when you do this:
if(str=="hello")
on the left you have a
pointer
, and on the right you have apointer
. The value of a pointer is the number it holds; a single memory address. So the value on the left would be something like …
All 4 Replies
Suzie999
245
Coding Hobbyist
Moschops
683
Practically a Master Poster
Featured Poster
moaz.amin.37
-12
Junior Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.