-
Couldn't load subscription status.
- Fork 0
зачёт-2 задача 2 #33
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?
зачёт-2 задача 2 #33
Conversation
| } | ||
| } | ||
|
|
||
| return (state == start ? false: true); |
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 (state == start ? false: true); | |
| return state != start; |
А то как будто != возвращает не булевое значение
| memoryError | ||
| } ExitCode; | ||
|
|
||
| ExitCode main(void) |
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 должен возвращать int
| #include <stdio.h> | ||
| #include <string.h> | ||
|
|
||
| #include "String.h" |
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.
У меня такого нет, не компилится. Хотя если это просто удалить, всё ок (видимо, у Вас оно подключало string.h и всё хорошо было, а у меня на линуксе String.h и string.h — совершенно разные файлы, и одного из них нет).
| const bool test(void) | ||
| { | ||
| const size_t testNumber = 10; | ||
| const char *const testStrings[testNumber] = {"ads34676_", "ва2345_3", "U", "F342", "QadfGfss_12343dfwgasf___", "2W", "Ф", "r", "", "432567854ew3"}; |
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.
Си на самом деле так не умеет, надо testNumber через #define объявлять. Некоторые компиляторы позволяют выделять массив неизвестной во врем компиляции длины на стеке (не должно смущать, что testNumber const, Си разрешает менять константные значения), но это не по стандарту. gcc такое не компилирует.
| const bool test(void) | ||
| { | ||
| const size_t testNumber = 10; | ||
| const char *const testStrings[testNumber] = {"ads34676_", "ва2345_3", "U", "F342", "QadfGfss_12343dfwgasf___", "2W", "Ф", "r", "", "432567854ew3"}; |
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.
isalpha возвращает true, если в текущей локали символ является буквой. У меня локаль ru_RU.UTF-8, и ничего против "ва" не имеет, тесты не проходят :) Надёжнее было бы либо вручную сравнивать коды символов, либо не требовать в тестах, чтобы русские буквы не принимались (потому как чем они не буквы, да и любой современный компилятор идентификаторы с кириллицей обижать не станет).
No description provided.