Я очень новичок в программировании, и я начал изучать C. Теперь я просто не могу понять, почему моя структура узла не видна моим функциям.struct uneclared (первое использование в этой функции)
Я пытаюсь получить некоторую помощь на http://www.cprogramming.com/tutorial/c/lesson7.html , но не повезло в использовании блоков кода 13.12
#include <stdio.h>
#include <stdlib.h>
struct node {
int data;
struct ptr * next;
};
struct node* head;
void Insert(int x)
{
struct node *temp;
temp = (node*)malloc(sizeof(struct node));
if(head == NULL)
head = temp;
temp->data = x;
temp->data = x;
temp->next = NULL;
struct node* temp1 = head;
while(temp1-> != NULL;) {
temp1 = temp1->next;
}
temp1->next = temp;
}
void print() {
struct node* temp = head;
while(temp != NULL) {
printf("the data is %d", temp->data);
temp = temp->next;
}
}
int main()
{
head = NULL;
int a,c;
printf("How many numbers ? : \n");
scanf("%d",&a);
for(i = 0; i<a; i++); {
printf("Enter a number:\n");
scanf("%d",&c);
Insert(c);
print();
}
}
что 'структура PTR * следующий;'? –
строка, начинающаяся с 'temp =' неверна: она пропускает ');' –
Существует много ошибок, но не «struct undeclared (first use in this function)» была для C99. – MikeCAT