このプログラムをデータ構造で作成していますが、node1がこのスコープで宣言されていないという次のエラーが発生します。問題がnode1がこのスコープで宣言されていないC++データ構造
#include<iostream>
#include<conio.h>
using namespace std;
struct node // I have created the struct of node here
{
int data;
struct node *next;
};
int main() {
node1;
node1 *head;
head = (node *) malloc(size of (node1));
if(head=null)
return;
head->data=1;
head->next=Null;
head->next=(node*)malloc(size of(node1));
head->next->data=2;
head->next->next=Null;
node1 *current=head;
while(current!Null)
{
cout<<current->data;
current=current->next;
}
}
あなたは正直なところ、これは有効なC++コードになるはずだったと思いますか? – WhozCraig
はい。これはC++コード –
'#include 'はまだTurbo C++を使用している人ですか? –
uSeemSurprised