CJCoding With Joseph
← Back to Question List
C Code Walkthrough #29

Swapping Array Ends

mediumArrays

📄 Code

Read carefully — what does this print?
1#include <stdio.h>
2int main() {
3 int arr[3] = {1, 2, 3};
4 int temp = arr[0];
5 arr[0] = arr[2];
6 arr[2] = temp;
7 printf("%d %d %d\n", arr[0], arr[1], arr[2]);
8 return 0;
9}

🎯 Your Answer