Help me in solving CLB088 problem

My issue

include <stdio.h>

int main() {
int arr = {1, 2, 3, 4, 5}; // Example array

// Calculate the size of the array
int length = sizeof(arr) / sizeof(arr[0]);

// Check if the array has at least one element
if (length > 0) {
    arr[length - 1] = 6; // Change the last element to 6
    printf("The last element is: %d\n", arr[length - 1]); // Print the last element
} else {
    printf("Array is empty.\n");
}

return 0;

}

My code

#include <stdio.h>

int main() {
    int arr[] = {1, 2, 3, 4, 5}; // Example array

    // Calculate the size of the array
    int length = sizeof(arr) / sizeof(arr[0]);

    // Check if the array has at least one element
    if (length > 0) {
        arr[length - 1] = 6; // Change the last element to 6
        printf("The last element is: %d\n", arr[length - 1]); // Print the last element
    } else {
        printf("Array is empty.\n");
    }

    return 0;
}

Learning course: Data structures & Algorithms lab
Problem Link: https://www.codechef.com/learn/course/muj-aiml-dsa-c/MUJADSAC05/problems/CLB088