这是课上的代码,想不使用指针而使效果等同于指针。可是我看不懂这个代码。(注:该代码是我根据课上的板书编写下来的,有可能有错,您也可以指出)
如果我的代码有很大错误,您也可以根据我的意思给出相应的代码。
【代码】
#include<bits/stdc++.h>
using namespace std;
int a[10];
int main(){
int n;
cin>>n;
struct node{
int data;
int next;
};
int head=0;
struct node pool[100];
for(int i=0;i<n;i++){
pool[i].data=a[i];
pool[3].data=a[i];
pool[3].next=head;
cout<<head;
}
return 0;
}