Returning a single character from a string, returns as a int?(bit operate
#1

So yeah, I have this stock

pawn Код:
stock GetFirstNumber(number)
{
    new
        number_str[12],
        bool: negative;
   
    if (number < 0) negative = true;
    valstr(number_str, number);
    return (negative) ? (number_str[1]) : (number_str[0]);
}
I pass it something between 1000 and 2000 and I get 49, I pass it something above 2000 and I get 50, and so forth. I was wondering why it's returning such strange numbers and if there's something wrong with the stock..

I've checked the integer i'm passing it, it's correct..
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)