can element be -ve value?

I have code in C :

tilt[0] = tilt[-tilt_step + 1];

my question, -tilt_step >> can element be -ve value? or it have another meaning?
An array of N elements is indexed from 0 .. N-1

A negative index is going to throw exceptions.

So long as -tilt_step + 1 is >= 0 it should be OK.

Edit: So long as it's also < N

Last edited on
Technically speaking... a negative value can be used legally... but you have to have a pointer that points into a buffer (not at the start of a buffer).

If your question is "can negative values be used like they are in python", then the answer is "no". As jim80y said.
Thank you
Topic archived. No new replies allowed.