#include<iostream>
using namespace std;
struct node{
int data;
struct node *next;
}*first;
void create(int a[],int n)
{
int i;
struct node *t, *last;
first = new struct node;
first->data = a[0];
first->next = NULL;
last=first;
for (i=1;i<n;i++){
t=new node;
t->data=a[i];
t->next=NULL;
last->next=t;
last=t;
}
}
void display(struct node *p){
while(p!=NULL){
cout<<p->data<<" ";
p=p->next;
}
}
int main(){
int A[] = {3,5,7,10,15};
create(A,5);
display(first);
}
error message:
Program 'Node.exe' failed to run: Access is deniedAt line:1 char:83
+ ... inked lists\" ; if ($?) { g++ Node.cpp -o Node } ; if ($?) {
.\Node }
+
~~~~~~.
At line:1 char:83
+ ... inked lists\" ; if ($?) { g++ Node.cpp -o Node } ; if ($?) {
.\Node }
+
~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [],
ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed
This is error is shows after running code. After I run any program an .exe file is created but here the .exe file gets deleted by my antivirus because it says it is a trojan...
If I run code in an online compiler it works perfectly