Skip to content

Созданы файлы для решения задачи палиндрома#10

Open
cutenti wants to merge 1 commit intomainfrom
Test2_142_Torgova
Open

Созданы файлы для решения задачи палиндрома#10
cutenti wants to merge 1 commit intomainfrom
Test2_142_Torgova

Conversation

@cutenti
Copy link
Owner

@cutenti cutenti commented Dec 5, 2025

No description provided.

Copy link
Collaborator

@p-senichenkov p-senichenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Палиндром: 3/20

for (int i=0; i <= (list->size)/2; i++){
if (top->value != end->value) {return 0;}
top = top->next;
end =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не, так у Вас ничего не выйдет. Либо нужен двусвязный список, либо совсем другой подход.

}listNode;

typedef struct List{
listNode* tail;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Очень странно хранить именно конец списка, а не начало. Кажется, что Вы этим только сильно всё усложнили.
И замыкать список в кольцо совсем не нужно.

#include <stdio.h>
#include "list.h"

typedef struct listNode{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Структуры объявляют в заголовочных файлах, а не в исходниках. Так оно не слинкуется (либо слинкуется, но с потенциальным нарушением ODR, а это UB).


int main(){
List* list = newList();
printf("Введите числа (Ctrl+D/Ctrl+Z для завершения):\n");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: Ctrl+Z не завершает программу.

Наберите sleep 20, нажмите Ctrl+Z и наберите ps. И посмотрите, будет ли так sleep

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вот объектный файл точно прикладывать не надо.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants