Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I properly use the strcmp() function?

function properly strcmp
0
Posted

How do I properly use the strcmp() function?

0

Carefully. First, note that it can return any integer, not just 1, 0, and -1. Many programmers find it counterintuitive that 0 corresponds to the strings being equal. Second, it is not guaranteed (or likely) to work if you pass it a NULL pointer. I get crazy results with the sqrt and other math functions. Be sure to #include in your program. Also, make sure that other functions returning doubles are correctly defined. Depending on your setup, you may need to tell the compiler to use the math library, e.g., “gcc hello.c -lm”.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123