If you have an array, then you can run to it using an index, like:
Code:
int array [N];
int index;
for (index = 0; index < N; index++)
{
/* Every element of the array is set to 1. */
array [index] = 1;
}
An array is a block of memory which is divided in blocks of certain size, the size of the blocks depends on the type of the array. In the example, the type is int, so each block has size sizeof(int). There are N blocks, the first block has index 0, the last block has index N-1.
>and what do I write after case 1: ......
After case 1, you want to store the character 'a' in the array. You can do it like this.
Code:
case 1:
string [index] = 'a';
/* Now increase index so that the next character will be
placed in the element next to where 'a' is stored. */
index++;
break;