You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (!strcmp (input_message, DIC_COMMAND_LIST) || !strcmp (input_message, DIC_COMMAND_HELP))
{
if (!strcmp (input_message, DIC_COMMAND_LIST))
{
return 1; //1 : list
}
else
{
return 2; // 2: help
}
}
이런식으로 되어 있는데
if (strcmp (input_message, DIC_COMMAND_LIST))
{
return 1; //1 : list
}
else if (strcmp (input_message, DIC_COMMAND_HELP))
{
return 2; // 2: help
}
else if ()
..
else if ()
..
else if ()
..
이렇게 하는게 낫습니다.
그리고 1, 2, 3, 4, 5 와 같이 상수를 부여할 때에는
여기에 의미있는 기호를 할당할 수 있는 enum을 사용하는 것이 좋습니다.
그리고 dic_cat_command를 만들었다면, 이 함수를 활용하여
다른 부분의 코드에서는 strcmp를 하지 않고, dic_cat_command를 호출하여 상수 비교를 하는 쪽이 좋습니다.
이때 상수비교는 switch 문으로 대체할 수 있습니다.
The text was updated successfully, but these errors were encountered:
이런식으로 되어 있는데
이렇게 하는게 낫습니다.
그리고 1, 2, 3, 4, 5 와 같이 상수를 부여할 때에는
여기에 의미있는 기호를 할당할 수 있는 enum을 사용하는 것이 좋습니다.
그리고 dic_cat_command를 만들었다면, 이 함수를 활용하여
다른 부분의 코드에서는 strcmp를 하지 않고, dic_cat_command를 호출하여 상수 비교를 하는 쪽이 좋습니다.
이때 상수비교는 switch 문으로 대체할 수 있습니다.
The text was updated successfully, but these errors were encountered: