My function brokes. It gives 0 errors but brokes when i run it...

int findk(int a,int b, int n)
{
    int m[1000];
    int j=1;
    for(i=1;i<=b;i++)
    {
        if((pow(2,i)>a)&&(pow(2,i)<b))
        {
            m[j]= pow(2,i);
            j++;
        }
    }
    int k=m[1];
    for(i=1;i<j;i++)if(m[i]>k)k=m[i];
    return k;
}

What values are you using for a, b and n?

What is the error output. can you post that here also?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.