Question on Classic big integer program
So I'm doing the one where you have to use linked lists to add integers up to 200 digits long.
I have the idea of what I want to do to make it happen but I'm struggling with a lot of coding.
So the numbers are stored in a file. (this isnt the actual sample file just an example [20 long each for this one])
1 88888888888888888888 11111111111111111111
So my first problem is getting the input into my linked list. Our instructor said we would want them entered in reverse order so we can start adding at the beginning of the ll rather than the end. Which I know could be accomplished by just repeatedly adding nodes at the beginning of the list (loop)
So I'm trying to use fgets to get the entire line of input since we dont know how long each number (except for the first will be 1 or 2 for add or subtract) then using strtok(with a space as the delimiter) to determine to use the add function or sub function then strtok again will get me the first big integer.
we just learned in our lab about fgets and strtok so I'm really unsure of how these would be coded to do what the above paragraph explains.
then once i have that figured out i would need a method of separating each digit so i can then move it into my linked list. if i understand correctly fgets gives you a pointer so i could use that to get the character and then atoi it to get the integer value then move it into my list?
Basically I'm asking how do you code fgets and strtok to get this line of input into your program:
1 88888888888888888888 11111111111111111111
edit: note that this is the second program in a computer science 1 course so just keep the answers to that level of coding knowledge please.