Comparing integers
#10

Haven't written a line of pawn for years (apart from bits of help on here) can't remember how sizeof(array) works on multidimensional arrays/enum, so here's a crap example i hope you can adapt.

Код:
DoesOrgExistID(orgid)
{
    if(orgid < 15)
    {
        new bool: orgExist = false;
	
        if(orgid == oInfo[orgid][OID])
        {
            orgExist = true;
	    printf("Org does exist");
        }	
    }
    else
        printf(<"Error> DoesOrgExistID 'oInfo' out of bounds index is %d but size is 15, orgid);
    return orgExist;
}
EDIT: Removed sizeof for above reasons.

If you get the error printed, then go back to where you call 'DoesOrgExistID' and make sure you dont use an index over 14.
Reply


Messages In This Thread
Comparing integers - by CloudLEL - 28.04.2016, 17:19
Re: Comparing integers - by Luis- - 28.04.2016, 17:24
Re: Comparing integers - by CloudLEL - 28.04.2016, 17:28
Re: Comparing integers - by iggy1 - 28.04.2016, 17:28
Re: Comparing integers - by Luis- - 28.04.2016, 17:30
Re: Comparing integers - by CloudLEL - 28.04.2016, 17:30
Re: Comparing integers - by CloudLEL - 28.04.2016, 17:33
Re: Comparing integers - by CrossUSAAF - 28.04.2016, 17:36
Re: Comparing integers - by CloudLEL - 28.04.2016, 17:39
Re: Comparing integers - by iggy1 - 28.04.2016, 17:39

Forum Jump:


Users browsing this thread: 1 Guest(s)