I ended up using a loop that repeats rg(A)-1 times, starting from the last node with a temporary variable, linking it to the previous one and updating the temporary variable.
Just in case anyone...
Type: Posts; User: Fiskker
I ended up using a loop that repeats rg(A)-1 times, starting from the last node with a temporary variable, linking it to the previous one and updating the temporary variable.
Just in case anyone...
Thanks.
By the way, to do the same thing but backwards (as in going from the last node to the first node in both 'row only paths'), do you agree that I would need 3 pointers to keep track of...
Yes, sorry.
Okay, yes, I was thinking that the container should have pointers pointing to each entry of both diagonals. Is this what you say in your second paragraph?
Just to be sure, the...
As for the why, it is an exercise that is given in this way and has to be solved so that you modify the matrix in the manner that I presented in my first post (see image).
I'm not sure what you...
What I mean by it is that when you edit the matrix, you go to the N node in the first row, then change it and make it point to the N-1 node in the second row, then go to the N-1 node in the second...
Basically the problem is to go through a matrix (a vector of linked lists) in a 'sand-clock' fashion (as in right; diag left-down; right; diag right-up).
I made the program, but after testing it,...
You are using it wrongly, please see:
do...while loop in C
Also, a break statement must be inside the loop, yours is clearly after the loop is executed.
Have you read this yet?
I debug with gdb by passing the -g flag when compiling.
GDB: The GNU Project Debugger
Debugging with GDB: Top
When running the program with the debugger, if you have a SIGSEGV you'll encounter...
As far as I can see I find it weird that you call strtok() and then pass token as a parameter, how do you know token is not NULL?
As a matter of fact it is:
#1 0x0000000000400a98 in pushWord...
customerType is an integer and "Domestic" is a string, why are you comparing them?
printf("Enter type of customer (Domestic or Commercial):\n");
This could be of the type 'D' for Domestic and 'C'...
Right. But how would you "put numbers in a string"?
Do remember how the char type is defined though.
As long as the user input is a stored in a string then the answer is yes.
If you choose...
Your loop condition is:
while (menuChoice != 3)
This means that if I enter anything different than the number 3 this condition is true, thus the loop will continue by showing the menu.
As for...
Hey,
You could use fgets(), you are as a matter of fact checking for the new line character as far as I can see (did not read it toroughly).
If you want to stick to fgetc() and read character...
If I input 333x3fd
Is tokenBeforeX = "333" & tokenAfterX = "3fd"?
I think you are doing just fine, in the above example you are just mistaking the loop condition:
for (col = 1; col = row*2-1; col++)
The '=' is the assignment opeartion, that means that your...
I understand, but if you don't provide information about what you are doing and what the problem is, meaning what exactly is happening with your current code, then it becomes hard to see what the...
But I want to see how you code it, what would you do?
What needs to be changed in the for loop that loops the columns, what is the new condition?
Okay so you are describing it, how do we code...
Oh, okay.
Well, you were fine by looping each row, and then every column, and printing an asterisk until the row was matched, that is:
1 asterisk in first row.
2 asterisks in second row.
.
n...
I guess you can always say that the point of the pyramid is always in the middle, and the middle is the base / 2, right?
I guess that gives you a starting ammount of spaces, then it decreases...
It is more likely you will be helped if you provide code and show what you tried, and in what areas of the code you don't know what to do, or don't understand how to move on, else it becomes rather...
The title specifies it. The code too.
What did you try? What is it that you don't understand?
What's the content of the text file?
Is it a simple integer? If it is say a string (a lot of chars), then there is no way it is being...
You are creating a variable then copying data and then using yet another variable, you could just use the parameter as was suggested in the comment above.
Also I would make sure data is not NULL...
Your indentation and bracket use are way off. It is hard to find a problem when reading the code becomes difficult.
Your problem lies in line 37.
Here's the code properly indented:
#include...