Need help with arrays.

Hi. I need help with arrays. I have problems with three different array-practices.
I'm using Dev-C++ 4.9.9.2

First:
I need to move array's slots one slot to left. (I don't know what they are called in english, english isn't my native language)
For example, if I'd make array a[10], how I could make it so that a[0] becomes a[1], a[1] becomes a[2]... and finally a[9] becomes a[0]?

Second:
How can I use "char" in array? I know how to make a[3][3] cout numbers like this:
1 2 3
4 5 6
7 8 9
But when I tried to use char "a[3][3]" and input something like {"a", "b", "c"} it didn't work...

Third:
How to swap rows and collumns?
For example, if I had int a[3][3] = {{1,2,3},{4,5,6},{7,8,9}}; How to make it like this:
1 2 3 ------- 1 4 7
4 5 6 ------- 2 5 8
7 8 9 ------- 3 6 9
^^^these collums become rows

I tried to google these but couldn't find anything. I'd appreciate any help.
Last edited on
you can make a[0] become a[1] and a[1] become a[2] and so on

1
2
int *a = new int[10];
a--;

But I don't think this is a good practice


but you cannot make a[9] become a[0]
one way to do it is just use if statement


second:
I don't really know what didn't work

third:
do you really have to ?
Can you just read it in another way ?
char array is initialized with 'a' not "a".

you want to everything to the left? just create a temporary variable to store of value and switch the values around, do this with a for loop. using if statement when you get to the last element.
I can't post any code because I am at work.

Topic archived. No new replies allowed.