Hello,

i need some help understand what im doing wrong. Please point me in the right direction.

i will just post the relevant code:

main function with :
Code:
int main()
{
    int array1[5];
    int array2[5];

einlesen(array1, 5);
....
....

arraySortieren(&array2, 5);
    for (int e = 0; e < 5; e++)
    {
        printf("\nDas ist der %i. Wert bei der sortierung: %i", e + 1, e + 1, array2[e]);
    }

getchar();
    return 0;
}
the einlesen functions looks like this: (input from user for the array elements)
Code:
void einlesen(int* array, int länge){
    for (int i = 0; i < länge; i++)
    {
        printf("Gib hier einen Wert ein");
        scanf("%i", &array[i]);
    }
    printf("\n");
}
the arraySortieren function looks like this:
Code:
void arraySortieren(int* array, int len){
    int tempStorage = 0;


    for (int e = len; e > 1; e--)
    {
        for (int i = 0; i < len - 1; i++)
        {
            if (array[i] < array[i + 1])
            {
                tempStorage = array[i];
                array[i] = array[i + 1];
                array[i + 1] = tempStorage;
            }
            
            tempStorage = 0;
        }
    }
}

Now here is the problem:

Bubblesorting Array elements-unbenannt4-jpg

i marked the relevant parts yellow.