Meaningful Variable Names Gone Wrong
can you rewrite the C code above with more meaningful variable names? Sure! Here is a version of the code with more descriptive variable names: void swap(int *a, int *b) { int temp = *a; *a = *b; *b = temp; } void bubble_sort(int *arr, int n) { for (int i = 0; i < n - 1; i++) { for (int j = 0; j < n - i - 1; j++) { if (arr[j] > arr[j + 1]) { swap(&arr[j], &arr[j + 1]); } } } } void print_array(int *arr, int n) { for (int i = 0; i < n; i++) { printf("%d ", arr[i]); } printf("\n"); }
A programming chat screenshot shows a user asking for C code to be rewritten with more meaningful variable names. The assistant returns essentially the same code with generic names like a, b, temp, arr, n, i, and j, making the supposedly descriptive rewrite the joke. It is used as a reaction to superficial refactoring, unhelpful AI coding answers, or requests for clearer code that change nothing. EN: A programming chat screenshot shows a user asking for C code to be rewritten with more meaningful variable names. The assistant returns essentially the same code with generic names like a, b, temp, arr, n, i, and j, making the supposedly descriptive rewrite the joke. It is used as a reaction to superficial refactoring, unhelpful AI coding answers, or requests for clearer code that change nothing.
- @ithueti / 8335 2022-12-02
- Type
- image
- Size
- 672×791 · 42.5 KiB
- Mood
- sarcastic
- Language
- en
- Added