Array
#10

Sorry for late reply but i found something. Its actually possible. Since pawn is type less we can make use string function strfind to check it . I made a small macro for convenience. Its actually faster than normal looping.But there is a disadvantage if we have an element value equal to 0 the checking stops on that index and further index would not be checked and will return -1.I will try to find a method to overcome this.

PHP код:
#define arrfind(%0,%1) strfind(%0,{%1},false,0)
main()
{
    new array[]={
6,2,3,3,2340,78};
    
printf"index = %d" arrfind(array,3));//will print 2
    

now there is another way for checking without looping which is recursion but i think normal looping is better than that.
Reply


Messages In This Thread
Array - by GoldenLion - 19.12.2016, 14:04
Re: Array - by SickAttack - 19.12.2016, 14:06
Re: Array - by GoldenLion - 19.12.2016, 14:08
Re: Array - by SickAttack - 19.12.2016, 14:09
Re: Array - by SyS - 19.12.2016, 14:11
Re: Array - by SickAttack - 19.12.2016, 14:18
Re: Array - by SyS - 19.12.2016, 14:19
Re: Array - by SickAttack - 19.12.2016, 14:22
Re: Array - by SyS - 19.12.2016, 14:24
Re: Array - by SyS - 18.03.2017, 14:15

Forum Jump:


Users browsing this thread: 2 Guest(s)