hi its been 2 years since the last time i program in c and this is my first after 2 years. So i'm not that familiar anymore to the syntax in c(especially i'm already programming in java). So my problem is, i don't know if i did something syntactically wrong in my code. But an error occurred and it said that: "invalid operands to binary +" to the line..

valString += tempExpName;

//valString and tempExpName are both of type string. I already included stdlib.h in my code, but it won't removed the error.

--please could someone explain to me what is really wrong? Thanks :)

Recommended Answers

All 3 Replies

The problem...your trying to add two char pointers...I think.

Could you post the rest of the code.

The problem...your trying to add two char pointers...I think.

Could you post the rest of the code.

thanks. I realized it after i posted it. I just can't add two char pointers/strings. I have to used the function strcat(str1, str2), right?

thanks. I realized it after i posted it. I just can't add two char pointers/strings. I have to used the function strcat(str1, str2), right?

Well if you want to append one string onto another, then yes use strcat.

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.