#include<bits/stdc++.h>
using namespace std;
struct Node{
int val;
Node*next;
};
Node*InsertAtEnd(Node*root,int x)
{
Node*newnode;
newnode->next=NULL;
newnode->val=x;
if(root==NULL)
{
root=newnode;
return root;
}
Node*currnode;
currnode=root;
while(currnode->next!=NULL)
{
currnode=currnode->next;
}
currnode->next=newnode;
return root;
}
void Print(Node*root)
{
Node*currnode;
currnode=root;
while(currnode!=NULL)
{
cout<<currnode->val<<" ";
currnode=currnode->next;
}
cout<<endl;
}
int main()
{
Node*root=NULL;
root=InsertAtEnd(root,7);
root=InsertAtEnd(root,5);
Print(root);
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKc3RydWN0IE5vZGV7CmludCB2YWw7Ck5vZGUqbmV4dDsKfTsKTm9kZSpJbnNlcnRBdEVuZChOb2RlKnJvb3QsaW50IHgpCnsKTm9kZSpuZXdub2RlOwpuZXdub2RlLT5uZXh0PU5VTEw7Cm5ld25vZGUtPnZhbD14OwppZihyb290PT1OVUxMKQp7CnJvb3Q9bmV3bm9kZTsKcmV0dXJuIHJvb3Q7Cn0KTm9kZSpjdXJybm9kZTsKY3Vycm5vZGU9cm9vdDsKd2hpbGUoY3Vycm5vZGUtPm5leHQhPU5VTEwpCnsKY3Vycm5vZGU9Y3Vycm5vZGUtPm5leHQ7Cn0KY3Vycm5vZGUtPm5leHQ9bmV3bm9kZTsKcmV0dXJuIHJvb3Q7Cn0Kdm9pZCBQcmludChOb2RlKnJvb3QpCnsKTm9kZSpjdXJybm9kZTsKY3Vycm5vZGU9cm9vdDsKd2hpbGUoY3Vycm5vZGUhPU5VTEwpCnsKY291dDw8Y3Vycm5vZGUtPnZhbDw8IiAiOwpjdXJybm9kZT1jdXJybm9kZS0+bmV4dDsKfQpjb3V0PDxlbmRsOwp9CmludCBtYWluKCkKewpOb2RlKnJvb3Q9TlVMTDsKcm9vdD1JbnNlcnRBdEVuZChyb290LDcpOwpyb290PUluc2VydEF0RW5kKHJvb3QsNSk7ClByaW50KHJvb3QpOwp9Cgo=