-
Notifications
You must be signed in to change notification settings - Fork 0
Добавлена 4-1 #2
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
Task 4-1/4-1.c
Outdated
| #include <stdio.h> | ||
| #include <math.h> | ||
| #include <stdbool.h> | ||
| #define sizeOfNumbers 20 |
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.
Константы через define обычно объявляются КАПСОМ_С_ПОДЧЁРКИВАНИЕМ
Task 4-1/4-1.c
Outdated
| int inverter = 0; | ||
| int multiplier = 1; | ||
| int increment = 0; | ||
|
|
||
| if (numberArray[0] == 1) | ||
| { | ||
| inverter = 1; | ||
| multiplier = -1; | ||
| increment = 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.
Не, это всё не нужно. Хотелось конверсии настоящего 32-битного (точнее, sizeof(int)) инта в массив бит, и обратно, там ничего специального со знаком делать не надо. У Вас какие-то непонятные 20-битные числа.
Task 4-1/4-1.c
Outdated
|
|
||
| int main() | ||
| { | ||
| int number1, number2; |
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 4-1/4-1.c
Outdated
| int number1Array[sizeOfNumbers]; | ||
| int number2Array[sizeOfNumbers]; | ||
|
|
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 4-1/4-1.c
Outdated
| int decSum; | ||
| decSum = binToDec(sumArray); |
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.
| int decSum; | |
| decSum = binToDec(sumArray); | |
| int decSum = binToDec(sumArray); |
No description provided.