-
Notifications
You must be signed in to change notification settings - Fork 0
Добавлена 3-1 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
yurii-litvinov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужны ещё проектные файлы
Task 3-1/3-1.c
Outdated
| #include <stdbool.h> | ||
| #include <stdlib.h> | ||
|
|
||
| void swapp(int* a, int* b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Оно "swap" обычно
Task 3-1/3-1.c
Outdated
| return; | ||
| } | ||
|
|
||
| int element, location; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Неинициализированные переменные запрещены стайлгайдом, и они объявлены раньше времени. Должны объявляться в месте первого использования, по одной, и сразу с начальным значением
Task 3-1/3-1.c
Outdated
| if (array[i] <= pivot) | ||
| { | ||
| swapp(&array[i], &array[index]); | ||
| index++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше ++index
Task 3-1/3-1.c
Outdated
| } | ||
| } | ||
|
|
||
| swapp (&array[index], &array[end - 1]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Пробел перед "(" при вызове функции не ставят
Task 3-1/3-1.c
Outdated
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Две пустые строки подряд не ставят
Task 3-1/3-1.c
Outdated
|
|
||
|
|
||
|
|
||
| bool arraysEqual(int array1[], int array2[], int len) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не сокращайте имена — правильнее length
Task 3-1/3-1.c
Outdated
| if (arraysEqual(array, arraySorted, arrayLength)) | ||
| { | ||
| return true; | ||
| } | ||
| return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Так не пишут. Правильно, конечно, return arraysEqual(array, arraySorted, arrayLength);
| int array1[] = {4, 1, 8, 5}; | ||
| int array1Sorted[] = {1, 4, 5, 8}; | ||
| int array1Length = 4; | ||
|
|
||
| int array2[] = {0}; | ||
| int array2Sorted[] = {0}; | ||
| int array2Length = 1; | ||
|
|
||
| int array3[] = {34, 2452, 143, 34, 134, 566, 3, 100, 1234, 1234, 34, 565, 544}; | ||
| int array3Sorted[] = {3, 34, 34, 34, 100, 134, 143, 544, 565, 566, 1234, 1234, 2452}; | ||
| int array3Length = 13; | ||
|
|
||
| if (test(array1, array1Sorted, array1Length) && test(array2, array2Sorted, array2Length) && test(array3, array3Sorted, array3Length)) | ||
| { | ||
| printf("Все тесты пройдены\n"); | ||
| return 0; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это всё тесты, им нечего делать в main. Вынесите в отдельную функцию
No description provided.