please help me with the doubt
Whats wrong in my doubt
@adarshsingh2k
Your code is correct but there are few mistakes.
- your midPoint(head) function return pointer to mid point. So cout<<midPoint(head); will print address of pointer. Thus change it to cout<<midPoint(head)->data;
- The input format given is wrong. In your code, you first take n then n node values but in input you just provide values of n node. provide value of n too.
- Inside buildlist() function, move cin>>data; above insertattail(head,data);
@adarshsingh2k
Here is the updated code: https://ide.codingblocks.com/s/292673
Input should be
9
1 2 3 4 5 6 7 8 9