Linked List: Returning value and inserting node

I'm having problems in 2 different functions: GetNth() and InsertNth()

1) For my GetNth() function, I want to take my linked list and an integer index and return the data value stored in the node at that index position. For example: {42,13,66}, the index of 1 should print out 13 from my Linked List.

2) For my InsertNth() function, I want to write a function that can insert a new node at any index within a list. The caller may specify any index in the range [0...length], and the new node should be inserted so as to be at that index.

I'm currently stuck with no where to go, so I'm gonig to try my best to explain the problems I am having.

My current result of my program is that my program runs but when it gets to my GetNth functions, my program crashes. It doesn't even get to the InsertNth function, so I can't really analyze it!

1)
I'm going to start with this function first (GetNth), so I can clarify things. For this funtion, I am trying to find the position of a number inside the Linked List and then return the value of that number.

For example: { 3, 4, 5, 4}

I want to find the number in position 2

the number will be 5.

Right now, I am returning current->info in the GetNth function. I'm unsure if I am suppose to be returning current->info because when I try:

current->info = GetNth(first,2) inside Main

I receive an error and says current is not declared. I'm just currently stuck on the function, and I need someone to guide me out.

2) For my InsertNth() function, I want to write a function that can insert a new node at any index within a list. The caller may specify any index in the range [0...length], and the new node should be inserted so as to be at that index.

I wrote code inside of my InsertNth function, but since my program crashes before I can even get to the function, I want to know if I did everything correctly. If I didn't, what should I add? I'm not sure if I'm suppose to add a for-loop in a Linked List. Also, do I need to use a cout statement to ask the user what position and number he/she wants to create the list with under this function? I know it's a lot of questions, but my book is not giving good examples to understand stand how to solve my problem.

1) In your current version of GetNth() what role do the variables number and searchCount play? If you're not going to use them, then delete them.

2) You declare GetNth() to have return type int but on line 28 when you call the function you ignore the return value. If you are going to ignore the return value you might as well make the return type void.

3) Is the node member variable called info the distance from first or the information stored in the node.

What happened to the other information InsertNth was going to get in the goal statement?

6) I think you need to comment your code or write out long hand on a sheet of paper what the function is going to do, what information the function needs to do what it is supposed to do, where it's going to get the information it needs to do what it is supposed to do. What the calling function is expecting back from the called function, and in what form is the calling function going to get that information back.

1) In your current version of GetNth() what role do the variables number and searchCount play? If you're not going to use them, then delete them.

2) You declare GetNth() to have return type int but on line 28 when you call the function you ignore the return value. If you are going to ignore the return value you might as well make the return type void.

3) Is the node member variable called info the distance from first or the information stored in the node.

What happened to the other information InsertNth was going to get in the goal statement?

6) I think you need to comment your code or write out long hand on a sheet of paper what the function is going to do, what information the function needs to do what it is supposed to do, where it's going to get the information it needs to do what it is supposed to do. What the calling function is expecting back from the called function, and in what form is the calling function going to get that information back.

Lerner! Thanks for replying to my post.

1) I guess none of them play a role for this function. Deleted = done.

2) I think I want to return the position of the value? I'm unsure if that is how it suppose to go.

3) info is the information stored in the node.

4) length of Linked List is the count that used in my CreateList function which is the function after main. It works pretty good.

5) Do I need to pass index and number in the function InsertNth?

6) I have weak skills in C++, and I'm trying to get better, but my sources suck lol.

My current result of my program is that my program runs but when it gets to my GetNth functions, my program crashes. It doesn't even get to the InsertNth function, so I can't really analyze it!

1)
I'm going to start with this function first (GetNth), so I can clarify things. For this funtion, I am trying to find the position of a number inside the Linked List and then return the value of that number.

For example: { 3, 4, 5, 4}

I want to find the number in position 2

the number will be 5.

Right now, I am returning current->info in the GetNth function. I'm unsure if I am suppose to be returning current->info because when I try:

current->info = GetNth(first,2) inside Main

I receive an error and says current is not declared. I'm just currently stuck on the function, and I need someone to guide me out.

2) For my InsertNth() function, I want to write a function that can insert a new node at any index within a list. The caller may specify any index in the range [0...length], and the new node should be inserted so as to be at that index.

I wrote code inside of my InsertNth function, but since my program crashes before I can even get to the function, I want to know if I did everything correctly. If I didn't, what should I add? I'm not sure if I'm suppose to add a for-loop in a Linked List. Also, do I need to use a cout statement to ask the user what position and number he/she wants to create the list with under this function? I know it's a lot of questions, but my book is not giving good examples to understand stand how to solve my problem.

Please tell me what I am doing wrong in my program and guide me to success...