We have a problem with our LinkedList in C.
When I count how many nodes should be in the list, I always get 1
LL count: 1
This is the Add, count and get last element of the list code:
void addLL(LL * head)
{
LL *newNode;
LL *tail = getLastNode(head);
newNode = malloc(sizeof(LL));
if(newNode != DEF_NULL)
{
newNode->ID=-1;
newNode->TCB=-1;
newNode->next = DEF_NULL;
if(!head) head = newNode;
else tail->next = newNode;
}
}
LL * getLastNode(LL * head)
{
LL *temp = head;
while(temp->next != DEF_NULL)
{
temp = temp->next;
}
return temp;
}
CPU_INT32U countLL(LL * head)
{
CPU_INT32U elements = 0;
LL * temp = head;
while(temp->next != DEF_NULL)
{
temp = temp->next;
elements++;
}
return elements;
}
It's called in this way:
addLL(list);
temp = countLL(list);
Debug_LOG("LL count: %i", temp);
where LL * list; is a global variable, and temp is in local scope.
I hope anyone can see where I went wrong
Greetings,
Sjaak and Gerrit
I see several issues in your code :
you should always protect your linked list operations by testing if the list pointer is valid (i.e. not null)
you cannot allocate a first item to an empty list due to the way you allocate the first new item : you change head but the modification won't be propagated outside of the function. You should pass a "pointer to a list pointer" (i.e. a LL**) that is equivalent to "the address of a LL*"; See how I call addLL() and how I have modified its prototype and the head assignment
if your list is only one block long, it won't be counted as you count only if there is a successor, see how I have modifed the order of the do / while condition
I propose the modified code that works for 1, 2 or any list length (I have just changed the CPU_INT32U to int to compile quickly with MinGW, I could have typedef'ined):
#include <stdio.h>
#define DEF_NULL 0
typedef struct tagL {
int ID;
int TCB;
struct tagL *next;
} LL;
void addLL(LL ** head);
LL * getLastNode(LL * head);
int countLL(LL * head);
void addLL(LL ** head)
{
LL *newNode;
LL *tail = getLastNode(*head);
newNode = malloc(sizeof(LL));
if(newNode != DEF_NULL)
{
newNode->ID=-1;
newNode->TCB=-1;
newNode->next = DEF_NULL;
if(!*head)
*head = newNode;
else
tail->next = newNode;
}
}
LL * getLastNode(LL * head)
{
LL *temp = head;
if (head){
while(temp->next != DEF_NULL)
{
temp = temp->next;
}
}
return temp;
}
int countLL(LL * head)
{
int elements = 0;
LL * temp = head;
if (head){
do {
temp = temp->next;
elements++;
} while(temp != DEF_NULL);
}
return elements;
}
int main(int argc, char *argv[]){
LL *list = 0;
printf("LL test\n");
addLL(&list);
printf("length = %d\n", countLL(list));
addLL(&list);
printf("length = %d\n", countLL(list));
addLL(&list);
printf("length = %d\n", countLL(list));
}
Output :
LL test
length = 1
length = 2
length = 3
On Windows nothing's wrong whit this function - strange ...
ideone also shows good output.
#include <stdio.h>
#include <stdlib.h>
typedef struct LL{
struct LL *next;
}LL;
LL * getLastNode(LL * head)
{
LL *temp = head;
while(temp->next != NULL)
{
temp = temp->next;
}
return temp;
}
void addLL(LL * head)
{
LL *newNode;
LL *tail = getLastNode(head);
newNode = malloc(sizeof(LL));
if(newNode != NULL)
{
newNode->next = NULL;
if(!head) head = newNode;
else tail->next = newNode;
}
}
int countLL(LL * head)
{
int elements = 0;
LL * temp = head;
while(temp->next != NULL)
{
temp = temp->next;
elements++;
}
return elements;
}
int main() {
LL *h = malloc(sizeof(*h));
addLL(h);
addLL(h);
addLL(h);
printf("%d\n", countLL(h)); // prints 3 as expected
}
CPU_INT32U countLL(LL * head){CPU_INT32U elements = 0;LL * temp = head;while(temp->next != DEF_NULL){temp = temp->next;elements++;}return elements;}
in this function you are declaring elements variable as auto
so its storage gets deallocated as soon as function exits , as memory now free to allocate to different variable, so may be overwritten hence previous cvalue gets lost
so to avoid this please use static in declaring variable.....
as static variables memory gets deallocated only after execution of whole program
please try....
void addLL(LL * head)
{
LL *newNode;
LL *tail = getLastNode(head);
There is a problem here, if (the global) head happens to be NULL, it will be dereferenced by the getLastNode() function:
LL * getLastNode(LL * head)
{
LL *temp = head;
while(temp->next != DEF_NULL)
Here temp->next != ... will cause temp to be dereferenced. That would cause NULL pointer dereferences if temp happens to be NULL. (as in the call by the insert function. You could add an extra test (or use pointers to pointers which is cleaner):
while(temp && temp->next != DEF_NULL)
Update (to show that the pointer to pointer version is cleaner)
#include <stdlib.h>
#include <stdio.h>
#define DEF_NULL NULL
#define CPU_INT32U unsigned
typedef struct link {
struct link *next;
} LL;
LL *globhead=NULL;
LL **getTailPP(LL **ppHead);
CPU_INT32U countLL(LL * ptr);
void addLL(LL **ppHead);
void addLL(LL **ppHead)
{
ppHead = getTailPP(ppHead);
*ppHead = malloc(sizeof **ppHead);
if(*ppHead != DEF_NULL)
{
// newNode->ID=-1;
// newNode->TCB=-1;
(*ppHead)->next = DEF_NULL;
}
}
LL **getTailPP(LL **ppHead)
{
for( ; *ppHead; ppHead = &(*ppHead)->next ) {;}
return ppHead;
}
CPU_INT32U countLL(LL * ptr)
{
CPU_INT32U elements = 0;
for(; ptr != DEF_NULL; ptr=ptr->next) { elements++; }
return elements;
}
int main()
{
unsigned count;
addLL( &globhead);
count = countLL (globhead);
printf("count = %u\n", count);
addLL( &globhead);
count = countLL (globhead);
printf("count = %u\n", count);
return 0;
}
Related
#include <stdio.h>
#include <stdlib.h>
typedef struct node{
int number;
struct node* next;
}
node;
int main(void){
node* list = NULL;
node *n = malloc(sizeof(node));
if(n==NULL){
return 1;
}
n->number = 2;
n-> next = NULL;
list = n;
n = malloc(sizeof(node));
if(n == NULL){
free(list);
return 1;
}
n->number = 3;
n->next = NULL;
list->next = n;
n = malloc(sizeof(node));
if(n == NULL){
free(list->next);
free(list);
}
n->number = 4;
n->next = NULL;
list->next->next =n;
n = malloc(sizeof(node));
if(n!=NULL){
n->number = 0;
n->next = NULL;
n->next = list;
list = n;
}
for( node* tmp = list; tmp != NULL; tmp->next){
printf("%i\n" , tmp->number);
}
while(list!=NULL){
node*tmp = list->next;
free(list);
list=tmp;
}
}
was trying linked list.
expected when running the code:
0
1
2
3
4
$
//asdoihasidashiofdhiohdfgdiwheifiopioioiophfaifjasklfhafiashfauiosfhwuiohwefuiowhfaslfidasdaskdasjdlaksdjqwfiqpweiojfkldfjsdfklwhefiowefweopfiosfkosid;fjwdfp;fdasiopfjew[0fowejfwepfojmofejmiwrfgj;wdfjewio;fijwefjsdp;jfkl;wjw
Actually you are not changing the pointer
for( node* tmp = list; tmp != NULL; tmp->next){
You need to write
for( node* tmp = list; tmp != NULL; tmp = tmp->next){
It will be even better to write
for ( const node* tmp = list; tmp != NULL; tmp = tmp->next ){
because within the loop the list is not being changed.
Also in this code snippet
if(n!=NULL){
n->number = 0;
n->next = NULL;
n->next = list;
list = n;
}
the statement
n->next = NULL;
is redundant.
In this loop, tmp->next has no effect because you don't assign it to anything.
for (node* tmp = list; tmp != NULL; tmp->next) {
printf("%i\n", tmp->number);
}
You must do tmp = tmp->next:
for (node* tmp = list; tmp != NULL; tmp = tmp->next) {
// ^^^^^
printf("%i\n", tmp->number);
}
Also, you can't expect 1 to be in the output because you never create a node with that number. With the above change the program will therefore output:
0
2
3
4
Sidenote: Your program is full of repetition which makes it hard to find errors and it's also what makes it harder to see that you forgot to add the node with the number 1. If you instead make functions of the things that you do repeatedly it'll be much clearer. You can also make functions with descriptive names to make the whole program easier to read and maintain.
If your program was rewritten to make use of functions, it could look like below - and then it'll be very obvious that the node with the number 1 is missing.
#include <stdio.h>
#include <stdlib.h>
typedef struct node node;
struct node {
int number;
node* next;
};
node *create_node(int number, node *next) {
node *nn = malloc(sizeof *nn);
if(!nn) exit(1);
// assign values to the new node:
*nn = (node){.number = number,
.next = next};
return nn;
}
void insert_first(node **list, int number) {
*list = create_node(number, *list);
}
void insert_last(node **list, int number) {
// find the last "next" pointer (the one pointing at NULL):
while(*list) list = &(*list)->next;
// make the pointer pointing at NULL now point at the new node:
*list = create_node(number, NULL);
}
void free_all(node **list) {
for(node *tmp; *list; *list = tmp) {
tmp = (*list)->next;
free(*list);
}
}
void print_all(const node *list) {
for (; list; list = list->next) {
printf("%d\n", list->number);
}
}
int main(void) {
node* list = NULL;
insert_last(&list, 2);
insert_last(&list, 3);
insert_last(&list, 4);
insert_first(&list, 0);
print_all(list);
free_all(&list); // list == NULL after this
}
Every k nodes form a segment. If the last few nodes are less than K, then you can ignore them.
Write a reverseKnodes() which reserves every segment in the linked list.
The function prototype is given as follow: void reversekNodes(ListNode** head, int k);
Input format:
The 1st line is the k
The 2nd line is the data to create the linked list and ends with a non-digit symbol Example:
Input: 3 1 2 3 4 5 6 7 8 9 10 a
Output: 3 2 1 6 5 4 9 8 7 10
#include <stdio.h>
#include <stdlib.h>
struct _listNode
{
int item;
struct _listNode *next;
};
typedef struct _listNode ListNode;
void printList (ListNode * head);
void deleteList (ListNode ** ptrHead);
void reverseKNodes (ListNode ** head, int K);
int
main ()
{
ListNode *head = NULL, *temp;
int i = 0;
int K = 0;
scanf ("%d", &K);
while (scanf ("%d", &i))
{
if (head == NULL)
{
head = (ListNode *) malloc (sizeof (ListNode));
temp = head;
}
else
{
temp->next = (ListNode *) malloc (sizeof (ListNode));
temp = temp->next;
}
temp->item = i;
}
temp->next = NULL;
reverseKNodes (&head, K);
printList (head);
deleteList (&head);
return 0;
}
void
printList (ListNode * head)
{
while (head != NULL)
{
printf ("%d ", head->item);
head = head->next;
}
printf ("\n");
}
void
deleteList (ListNode ** ptrHead)
{
ListNode *cur = *ptrHead;
ListNode *temp;
while (cur != NULL)
{
temp = cur->next;
free (cur);
cur = temp;
}
*ptrHead = NULL;
}
void
reverseKNodes (ListNode ** head, int K)
{
struct _listNode *reverse (struct _listNode *head, int k){
if (!head)
return NULL;
struct _listNode* cur = head;
struct _listNode* next = NULL;
struct _listNode* prev = NULL;
int count = 0;
while (cur != NULL && count < K)
{
next = cur->next;
cur->next = prev;
prev = cur;
cur = next;
count++;
}
if (next != NULL)
head->next = reverse(next, K);
return prev;
}
}
I am not allowed to change anything else other than the void function for reverseKNodes and I know I have done it wrong but I dont know where I went wrong. Could someone help me please?
A few issues with nested functions ...
Nested functions aren't standard C.
Are of limited benefit.
They add extra overhead to invoke.
So [please] don't use them.
And, your usage of one is incorrect. In reverseKNodes, you define reverse but never call it. So, reverseKNodes is a no-op.
So, to fix, move reverse out of the body of reverseKNodes and place it above. Then, actually invoke it in reverseKNodes:
void
reverseKNodes(ListNode **head, int K)
{
*head = reverse(*head, K);
}
Here is the full refactored code. For aid in debug (e.g. with gdb), I added code to allow the program to take an input file as an argument.
#include <stdio.h>
#include <stdlib.h>
struct _listNode {
int item;
struct _listNode *next;
};
typedef struct _listNode ListNode;
void printList(ListNode *head);
void deleteList(ListNode **ptrHead);
void reverseKNodes(ListNode **head, int K);
int
main(int argc,char **argv)
{
ListNode *head = NULL, *temp;
int i = 0;
int K = 0;
--argc;
++argv;
FILE *xf;
do {
if (argc != 1) {
xf = stdin;
break;
}
xf = fopen(*argv,"r");
if (xf != NULL)
break;
perror(*argv);
exit(1);
} while (0);
fscanf(xf,"%d", &K);
while (fscanf(xf,"%d", &i)) {
if (head == NULL) {
head = (ListNode *) malloc(sizeof(ListNode));
temp = head;
}
else {
temp->next = (ListNode *) malloc(sizeof(ListNode));
temp = temp->next;
}
temp->item = i;
}
temp->next = NULL;
reverseKNodes(&head, K);
printList(head);
deleteList(&head);
return 0;
}
void
printList(ListNode *head)
{
while (head != NULL) {
printf("%d ", head->item);
head = head->next;
}
printf("\n");
}
void
deleteList(ListNode **ptrHead)
{
ListNode *cur = *ptrHead;
ListNode *temp;
while (cur != NULL) {
temp = cur->next;
free(cur);
cur = temp;
}
*ptrHead = NULL;
}
struct _listNode *
reverse(struct _listNode *head, int K)
{
if (! head)
return NULL;
struct _listNode *cur = head;
struct _listNode *next = NULL;
struct _listNode *prev = NULL;
int count = 0;
while (cur != NULL && count < K) {
next = cur->next;
cur->next = prev;
prev = cur;
cur = next;
count++;
}
if (next != NULL)
head->next = reverse(next, K);
return prev;
}
void
reverseKNodes(ListNode **head, int K)
{
*head = reverse(*head, K);
}
Here is the program output:
3 2 1 6 5 4 9 8 7 10
#include <stdio.h>
#include <stdlib.h>
struct node
{
int data;
struct node *next;
};
typedef struct node node;
node* insertFront(node* head, int d);
node* insertBack(node* head, int d);
void print(node* head);
int max(node* head);
int min(node* head);
int locInList(node* head, int x);
int main()
{
node* head = NULL;
node* temp = NULL;
head = malloc(sizeof(node));
head = insertBack(head, 5);
head = insertFront(head, 4);
head = insertFront(head, 3);
head = insertBack(head, 6);
head = insertBack(head, 7);
print(head);
printf("\nMax: %d\n", max(head));
printf("Min: %d\n", min(head));
printf("locInList 5: %d\n", locInList(head, 5));
printf("locInList 9: %d\n", locInList(head, 9));
return 0;
}
node* insertFront(node* head, int d)
{
node *tmp = NULL;
tmp = malloc(sizeof(node));
tmp->data = d;
tmp->next = head;
head = tmp;
return head;
}
node* insertBack(node* head, int d)
{
node *ptr;
ptr->data=d;
ptr->next = NULL;
if(head==NULL)
{
head->data=d;
head->next=NULL;
}
else
{
node *temp=head;
while(temp->next != NULL)
{
temp=temp->next;
}
temp->next=ptr;
}
return head;
}
void print(node* head)
{
node *tmp = head;
while(tmp != NULL)
{
printf("%d ", tmp->data);
tmp = tmp->next;
}
}
int max (node* head)
{
int max;
while (head != NULL)
{
if (max > head->data)
max = head->data;
}
return max;
}
int min (node* head)
{
int min;
while (head != NULL)
{
if (min < head->data)
min = head->data;
}
return min;
}
int locInList(node* head, int x)
{
}
I'm having trouble with my InsertBack function, I want to add the value of d to the end of head.
The current output I'm getting with this code is:
3 4 0 7 7 7 7 7 7 7...repeating
The output should look like this
34567
Max: 7
Min: 3
Any help would be appreciated. I'm also very new to linked lists. So any help would be very appreciated!!
Here
node* insertBack(node* head, int d)
{
node *ptr;
ptr->data=d; // Dereference uninitialized pointer !!
ptr->next = NULL; // Dereference uninitialized pointer !!
if(head==NULL)
{
head->data=d; // Dereference NULL pointer !!
head->next=NULL; // Dereference NULL pointer !!
}
you have a major problem. You don't allocate memory! So you are dereferencing an uninitialized pointer. That's bad.
Try:
node* insertBack(node* head, int d)
{
node *ptr = malloc(sizeof *ptr);
ptr->data=d;
ptr->next = NULL;
if(head==NULL) return ptr;
...
For starters this statement in the beginning of main
head = malloc(sizeof(node));
does not make sense. You created an uninitialized node. As a result the program already invokes undefined behavior if you will try to perform any operation with the list except freeing the allocated memory.
Remove this statement.
You forgot to allocate memory for a node in the function insertBack.
node* insertBack(node* head, int d)
{
node *ptr;
ptr->data=d;
ptr->next = NULL;
//...
Also the body of the if statement
if(head==NULL)
{
head->data=d;
head->next=NULL;
}
does not make sense.
If to leave the function declaration as is then its definition can look the following way
node * insertBack( node *head, int d )
{
node *ptr = malloc( sizeof( node ) );
ptr->data = d;
ptr->next = NULL;
if ( head == NULL )
{
head = ptr;
}
else
{
node *temp = head;
while ( temp->next != NULL )
{
temp = temp->next;
}
temp->next = ptr;
}
return head;
}
Also these functions
int max (node* head)
{
int max;
while (head != NULL)
{
if (max > head->data)
max = head->data;
}
return max;
}
int min (node* head)
{
int min;
while (head != NULL)
{
if (min < head->data)
min = head->data;
}
return min;
}
are invalid because at least variables max and min were not initialized. Moreover they have an infinite loop and for example the function max is not finding the maximum value in the list.:)
It would be better to declare them like for example this
int max ( node* head, int *value );
In this case the definition of the function max could look like
int max( node* head, int *value )
{
int success = head != NULL );
if ( success )
{
*value = head->data;
while ( ( head = head->next ) != NULL )
{
if ( *value < head->data ) *value = head->data;
}
}
return success;
}
and the function can be called like
int max_value;
if ( max( head, &max_value ) )
{
printf( "The maximum value is %d\n", max_value );
}
The function min could be declared and defined the same way.
If to leave the function declarations as is then you have at least initialize the variables to 0. For example
int max (node* head)
{
int max = head == NULL ? 0 : head->data;
for ( ; head != NULL; head = head->next )
{
if ( max < head->data ) max = head->data;
}
return max;
}
The similar way can be defined the function min. Though as I pointed out it is better when the functions are defined the way I showed above.
And do not forget to write a function that will free the all allocated memory.
I am new to C and try to learn how to implement C on linked list. I am really confused why I can't access myList in the main function? because when I try to myList->data, it's segmentation fault. I think there's some error in my addtohead function?
Below is my code:
#include <stdio.h>
#include <stdlib.h>
typedef struct NODE{
int data;
struct NODE *next;
}node;
node * myList;
node * addToHead(node*, int);
void printList();
int main(){
myList = NULL;
int input;
while (scanf("%i",&input) == 1){
addToHead(myList, input);
printf("%d \n", myList->data);
}
printf("My List:\n");
printList(myList);
return 0;
}
node* addToHead(node* head, int newData){
node *temp = (node *)malloc(sizeof(node));
temp -> data = newData;
temp -> next = NULL;
if(head != NULL){
temp -> next = head;
}
head = temp;
return head;
}
void printList(node* head){
node *temp = head;
while(temp != NULL){
printf("%d ", temp->data);
temp = temp -> next;
}
printf("\n");
}
Your addToHead function is supposed to return the mallocated memory back to caller.
So you should assign the return value to mylist at first:
int main(){
node *myList = NULL;
int input;
while (scanf("%i",&input) == 1){
myList = addToHead(myList, input);
printf("%d \n", myList->data);
}
printf("My List:\n");
printList(myList);
return 0;
}
Into your addToHead function you wrote
head = temp;
But head has local scope and the assigned value is not reflected to the pointer myList.
To do so you have to use pointer to pointer.
int main(){
node *myList = NULL;
int input;
while (scanf("%i",&input) == 1)
{
if (addToHead(&myList, input) == true)
{
printf("%d \n", myList->data);
}
else
{
fprintf(stderr, "Error addToHead\n");
}
}
return 0;
}
bool addToHead(node** head, int newData){
node *temp = malloc(sizeof(node));
if (temp != NULL)
{
temp -> data = newData;
temp -> next = NULL;
if(head != NULL)
{
temp -> next = *head;
}
*head = temp;
return true;
}
return false;
}
Finally always remember to check the malloc return value: it can fail.
You return the new head node from addToHead, but you don't do anything with it. You need to assign this value to myList to update it:
myList = addToHead(myList, input);
Also, you misspelled a variable on the following line:
printf("%d \n", myListd->data);
It should be:
printf("%d \n", myList->data);
In this function definition
node* addToHead(node* head, int newData){
node *temp = (node *)malloc(sizeof(node));
temp -> data = newData;
temp -> next = NULL;
if(head != NULL){
temp -> next = head;
}
head = temp;
return head;
}
The parameter node* head is a local variable of the function. Any changes of the parameter will not influence on the original argument. The function parameters will be destroyed after exiting the function.
You can consider the function definition and its call the following way
addToHead(myList, input);
//...
node* addToHead(/*node* head, int newData*/){
node *head = myList;
int newData = input;
node *temp = (node *)malloc(sizeof(node));
temp -> data = newData;
temp -> next = NULL;
if(head != NULL){
temp -> next = head;
}
head = temp;
return head;
}
So the original variable myList will not be changed after the function call. You have to assign explicitly the returned value to the variable
myList = addToHead(myList, input);
Also the function has a drawback. It does not report an error in case when the new node was not allocated.
A better approach to write the function looks the following way
int /* _Bool */ addToHead( node **head, int newData )
{
node *temp = ( node * )malloc( sizeof( node ) );
int /* _Bool */ success = temp != NULL;
if ( success )
{
temp -> data = newData;
temp -> next = *head;
*head = temp;
}
return success;
}
In this case the function can be called in a loop the following way
while ( scanf( "%i", &input ) == 1 && addToHead( &myList, input ) )
{
//...
}
void add_tail_r(list ** head, int elem)
{
list *current=*head;
list *temp = NULL;
if (current->next==NULL)
{
if (!( temp=(list *)malloc(sizeof(list )) ))
printf("Error");
temp->elem=elem;
temp->next=NULL;
current->next=temp;
return;
}
else
{
add_tail_r (current->next,elem);
}
}
I have this recursive function that have to insert an element into the list but when the function is recursively called it goes into an infinite loop.
How can I declare 'current' and 'temp' static if they are a self-declared types?
How can I fix this?
typedef
struct list{
int elem;
struct list*next;
} list;
void add_tail_r (list* head, int elem)
{
list* new = NULL;
list* temp = head;
while (temp->next != NULL)
{
temp = temp->next;
}
new = (list*) malloc (sizeof (list));
new->elem = elem;
new->next = NULL;
temp->next = new;
}
I hope I did not make any mistake, I am currently without a C-compiler.
The intended function of it is to take a list element and iterate forward through its ->next pointer until we reach a NULL value, which means we've reached the end of the line. Once we are on that row we can allocate memory for a new element with void* malloc (size_t size);
Once we are on that part we can assign its ->elem value to our elem.
Edit #1 This takes away the recursion part, if that is required then discard this.
#include <stdlib.h>
#include <stdio.h>
typedef struct list{
int elem;
struct list*next;
} list;
void add_tail_r(list ** head, int elem)
{
list *temp = NULL;
if (*head == NULL)
{
if (!( temp=(list *)malloc(sizeof(list ))))
{
printf("Error ..");
return;
}
temp->elem = elem;
temp->next = NULL;
*head = temp;
}
else
{
add_tail_r (&(*head)->next,elem);
}
}
void print_list(list * head)
{
list *tmp=head;
while(tmp != NULL)
{
printf("%d\n" , tmp->elem);
tmp = tmp->next;
}
}
list * my_head = NULL;
int main()
{
add_tail_r(&my_head, 10);
add_tail_r(&my_head, 8);
add_tail_r(&my_head, 6);
add_tail_r(&my_head, 4);
add_tail_r(&my_head, 2);
print_list(my_head);
return 0;
}