C inner product function without using array subscripting
I have a few comments on style.  (By which I really mean, 100% opinion... :D)



One declaration per line

A lot of people strongly disagree with this, but I find it much easier to read code that has one declaration per line.

const int *p;
const int *q;


Is a lot clearer to me than:

const int *p, *q;


Though really, the only time I've vehemently opposed to it is if both variables are not the same in terms of a pointer or value:

const int *p, q;


Is a harder to read and more prone to errors than:

const int *p;
const int q;




n

I would name the n paramter something more meaningful.  I would consider calling it size or num.

It's fairly apparent that n is meant to be the number of elements, but two or three extra keystrokes seems worth the extra clarity.



Possible implementation

I would probably write the function something like this:

int inner_product(const int *a, const int *b, int num)
{

    const int* end = a + num;

    int sum = 0;

    while (a != end) {
            sum += (*a) * (*b);
            ++a;
            ++b;
    }

    return sum;

}


Since the two pointers are incremented at the same time, there's no reason to check both.

This should be a tiny bit more efficient (well... probably not once the compiler does it's magic optimisations on the original), and I think it's a bit clearer.