arithmetic « Dimensional Array « C Array Q&A

Home
C Array Q&A
 1 bit 2 Byte 3 char 4 class 5 Development 6 Dimensional Array 7 dynamic 8 element 9 find 10 index 11 initialization 12 Integer 13 length 14 loop 15 memory 16 Operation 17 pointer 18 Print 19 size 20 Sort Search 21 string 22 struct 23 variable
 C Array Q&A » Dimensional Array » arithmetic

1. C pointer arithmetic for 2D arrays    stackoverflow.com

``````// strings is a 2D array (each string is 11 bytes long)
char strings[][11] = {"0123456789", "2222244444", "3333366666"};

printf("String 3 Character 2 is %c\n", strings[2][1]);
``````
How can I code this print ...

2. 2D pointer arithmetic in C    stackoverflow.com

I am attempting to swap 2 elements in a 2D array in C, with no luck. Thanks for the answers so far, but I have edited this code to make things clearer ...

3. C weird array syntax in multi-dimensional arrays    stackoverflow.com

I've known that this is true:

``````x[4] == 4[x]
``````
What is the equivalent for multi-dimensional arrays? Is the following true?
``````x[4][3] == 3[x[4]] == 3[4[x]]
``````

4. pointer arithmetic and multi-dimensional arrays    bytes.com

Bernd Gaertner Dear experts, according to my interpretation of the Standard, loop 1 in the following program is legal, while loop 2 is not (see explanation below). This looks a bit counterintuitive, though; do you know the truth? Thanks a lot in advance, Bernd Gaertner. #include int main() { int a[2][3] = { {0, 1, 2}, {3, 4, 5} }; int* ...