Why is it switched up?
#4

sscanf returns 0 when succeed, and 1 when failed,
Код:
if(sscanf(params, "rd", id, dif))
{
the code under this statement is called when a failure occurs of sscanf function here.

the code under else { is called when sscanf returns 0 (success)

so, to check if sccanf succeed, which means it returned 0:
Код:
if(!sscanf(params, "Rd", id, dif))
that means if the function sscanf returned a zero, and without the NOT operator ("!") it means if the function returned another value higher than zero
Reply


Messages In This Thread
Why is it switched up? - by danielpalade - 18.07.2016, 17:53
Re: Why is it switched up? - by oMa37 - 18.07.2016, 18:07
Re: Why is it switched up? - by GangstaSunny - 18.07.2016, 18:32
Re: Why is it switched up? - by Sawalha - 18.07.2016, 18:57

Forum Jump:


Users browsing this thread: 1 Guest(s)