¿¹Á¦
ù ¹øÂ° if ¹®Àº Àμö°¡ °°ÀºÁö °Ë»çÇÏ·Á´Â °ÍÀ¸·Î º¸ÀÏ ¼ö ÀÖÁö¸¸, Àμö°¡ ´Ù¸¥ °æ¿ì¿¡¸¸ ¼º°øÇÒ °ÍÀÔ´Ï´Ù.
void
foo(
char
*string1,
char
*string2)
{
if
( strcmp(string1, string2) ) {
//the strings are the different
}
if
( !strcmp(string1, string2) ) {
//the strings are the same
}
}
¼Ö·ç¼Ç
ÀÌ·¯ÇÑ ¿À·ù¸¦ ÇÇÇϱâ À§ÇØ ÄÚµù °¡À̵å¶óÀο¡ µû¶ó if ¹®À» ¾Æ·¡¿Í °°ÀÌ ½á¾ß ÇÕ´Ï´Ù.
void
foo(
char
*string1,
char
*string2)
{
if
(strcmp(string1, string2) != 0) {
//the strings are the different
}
if
( strcmp(string1, string2) == 0) {
//the strings are the same
}
}