S
It seems that the most important thing you have in mind is the separation of variable announcements and their direct use.Let's start with this line.Node_t *head;
That line sometimes writes it.Node_t* head;
And that's the key. In both cases, an index (because a star) on Node_t with a head name is announced. The only difference is reading.But the star can also mean the denomination of the indicator (when it is written in terms like this). *head() and in this case, it may be assumed that the site of the design is simply not the index but the object itself (structure, variable).And the star is just a multiplication:now paragraph 1 - head - it's just an index. He's being handed over.*head The announcement is an index. And in terms, the name of the indicator.Paragraph 2 - cur and head - Index. They can easily be assigned to each other. No problem.Item 3. It's a little harder. In the function of pushing two stars at the first argument, the index, and in paragraph 3 the head is simply an index. And whatever it takes to turn the index into an index, you have to add. &♪ I mean, the ampersand adds the level of cosmetic, and the star is cleaning.There's a question, and why do you need an index? All is simply - if the variable needs to be modified (and have access to the retrofit value after the function is challenged) - the indicator is transmitted to it (and it is not important that the variable indicator itself is). If the variable doesn't need to be modified, we shall be transmitted in value (although no one prevents transmission to the index).That's what it says in paragraph 4 - send the index to the index. Yeah, the variable's address is an index to this variable.P. S.How do you even make the main by GoThroughList's function take the right list, not just 0?It's a worker's job, she's doing it right. It just doesn't contain what you're waiting for.With the help of " we get the object's address, with the help of using it, we get the object. Only by applying to the indicator, not to the " .By the logic of things, you have to modify the list, and the list is stored in the index. That's why you need to find a sign for the index. That's it.find(&head, values[i]); // передаём в функцию указатель (1) head
And of course, we need to rewrite the function.void find(Node_t **head, int newVal) { // тут указатель на указатель
Node_t *cur =
*head; // теперь нужно head разыменовывать
int res = 0;
while (cur != NULL) {
if (cur->val == newVal)
res = 1; // такой элемент уже есть в списке
cur = cur->next;
}
cur = *head; // аналогично
if (res == 0)
// элемент уникален
push(head, newVal); // а тут head и так адрес.
}