Constant pointer array or pointer to an array ? What is faster in C? -


hello i'm in intermediary c class right , thought came mind:

int multi[3][4]; // const multidimensional array  int* ptr = *multi; // ptr pointer variable hold address of multi const array 

so, faster/smaller/optimized access multidimensional array position?

this:

multi[3][1]; // index value position 

or

*(*(multi+2)+1); // pointer position on array 

or (updated)

ptr += 9; // pointer arithmetic using auxiliary pointer 

since "multi" const array compiler should "know" localization of element position, in case of using variable pointer pointing array take more processing time, on other hand faster when searching item want display. faster/smaller/optimized approach?

thank in advance.

they're compiled in same way, *(pointer_to_first_element + x + y).


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -