Forum: Computer Science Mar 25th, 2007 |
| Replies: 2 Views: 2,498 The source code is appended below. Many apologies and really appreciate any help from anyone.
--------------------------------------
for i=1:50
Bcount(i)=0;
end
% start considering node k... |
Forum: Computer Science Mar 25th, 2007 |
| Replies: 2 Views: 2,498 get the following error message when I have have a variable QUEUE
and then for i:2500, I loop through QUEUE(i). I don't understand why
Matlab is attempting to access QUEUE(-2.14748e+009)....Can... |
Forum: C Mar 13th, 2005 |
| Replies: 13 Views: 4,245 I think I have just found the answer to my own question....thanks to all for looking! :) |
Forum: C Mar 13th, 2005 |
| Replies: 13 Views: 4,245 Dear Stack Overflow,
I have a funny observation which I am not sure if it makes any sense. With regards to your code
/* free rows made by MATRIXint() */
/* where V represents the rows */... |
Forum: C Mar 10th, 2005 |
| Replies: 13 Views: 4,245 Thanks, Narue and Stack Overflow (esp. for your memory allocation techniques). :) |
Forum: C Mar 10th, 2005 |
| Replies: 13 Views: 4,245 Thanks Narue,
"You can get a segmentation fault because malloc failed and returned a null pointer,"
what could be reasons for malloc to fail then? What I meant when I said that the system... |
Forum: C Mar 10th, 2005 |
| Replies: 13 Views: 4,245 Hmm...interesting. Maybe this will unravel the mystery behind my recent encounters with "segementation faults" when I try to run my program in UNIX. Although I am aware of the various reasons for... |
Forum: C Mar 10th, 2005 |
| Replies: 13 Views: 4,245 Thanks, Stack Overflow and Tight_Coder_Ex.
Stack Overflow - I understand what you mean about the variable q can only point to one thing at a time and the problem that might arise. So if the... |
Forum: C Mar 10th, 2005 |
| Replies: 13 Views: 4,245 Hi Guys, it's me again! I have been posing memory-related problems for the past few days because I don't seem to understand what is the problem with my code. I kind of figured it's due to memory... |
Forum: C Mar 9th, 2005 |
| Replies: 18 Views: 6,270 Yes, i got the same printout too (ie. the first two are the same while the last two are zeros), only that the values are different but that's ok since we are using differnet computers.
Guess I got... |
Forum: C Mar 9th, 2005 |
| Replies: 18 Views: 6,270 Really thank you for your efforts.
1) could you tell me what it means by "function scope"?
2) I was actually expecting to see the same thing (printout) for "Before call" and "Function scope... |
Forum: C Mar 9th, 2005 |
| Replies: 18 Views: 6,270 Oh sorry but one more question:
If memory is allocated in the main function (via malloc), say to G, if I pass G into a function, can the memory be freed inside the function via free(G) or do I... |
Forum: C Mar 9th, 2005 |
| Replies: 18 Views: 6,270 Great!
Thanks Stack Overflow and Narue! |
Forum: C Mar 9th, 2005 |
| Replies: 18 Views: 6,270 Thanks, it does help me understand a little better. So does it mean that even though the second time I call to print (after free(G);)
printf("%d\n", G->E);
the program was able to give me... |
Forum: C Mar 9th, 2005 |
| Replies: 18 Views: 6,270 Thanks, that's why I thought that after I "free(G)", the code
printf("%d\n", G->E);
should not be able to return me a value of 10. when it does, it surprises me, which makes me wonder... |
Forum: C Mar 9th, 2005 |
| Replies: 18 Views: 6,270 Apologies for my previous code....the free function should be
free(G);
I mistyped it. Any help would be greatly appreciated. |
Forum: C Mar 9th, 2005 |
| Replies: 18 Views: 6,270 The free() function is still puzzling me in some sense. I have a simple code below which creates a structure called graph. The code compiles without any problem and when it is executed, the output... |
Forum: C Mar 8th, 2005 |
| Replies: 18 Views: 6,270 thanks! help appreciated. |
Forum: C Mar 8th, 2005 |
| Replies: 18 Views: 6,270 I did try the free(q), but was surprised when the following thing happened:
when there were still items on my queue, i did a free(q) and then tried to access items on my queue, it turns out that... |
Forum: C Mar 8th, 2005 |
| Replies: 18 Views: 6,270 I have a first-in-first-out queue implementation such that when it is first initialized, a malloc is called to set aside memory for items that will be placed on the queue. When I am done with the... |
Forum: C Mar 3rd, 2005 |
| Replies: 8 Views: 15,715 I have been trying to find out where the bug is but so far I have no luck.
Is it possible to have segmentation fault when the system "run out of memory"? |
Forum: C Mar 2nd, 2005 |
| Replies: 8 Views: 15,715 if there is a bug in the code, why doesn't it show when I compile?
how can i rectify the problem?
I thought segmentation fault has got to do with memory errors...
or is this a portability issue? |
Forum: C Mar 2nd, 2005 |
| Replies: 8 Views: 15,715 Can anyone please explain to me the following strange phenomenon?
I have a code in C, and when I compile it is Windows Platform compiler (Borland 5.5), they compiling is fine and when I execute... |
Forum: C Feb 11th, 2005 |
| Replies: 0 Views: 4,093 Hi Guys/Gals,
Is anyone of you using/reading the above book by Robert Sedgewick?
I am trying to write some graph algorithms using C and trying to learn it using the above book. Having some... |
Forum: C Feb 8th, 2005 |
| Replies: 7 Views: 2,628 I've finally got it!
Thanks a million!!!! :cheesy: |
Forum: C Feb 8th, 2005 |
| Replies: 7 Views: 2,628 So I have declared
"Edge EDGE(int,int)"
but did not define it? |
Forum: C Feb 8th, 2005 |
| Replies: 7 Views: 2,628 So the error is that I "declared"
EDGE(int,int)
but I didn't define it? |
Forum: C Feb 8th, 2005 |
| Replies: 7 Views: 2,628 Thanks for the reply. I did some checking on my code but still can't figure out where the missing declaration or definition is at. I have enclosed my code below, so if anyone could help me check... |
Forum: C Feb 8th, 2005 |
| Replies: 7 Views: 2,628 Hi,
I wrote a program in C and when I compiled, got the following message (word for word):
Error: Unresolved external '_EDGE' referenced from C:\Graph\Test1.OBJ
The funny thing is that the... |
Forum: C Jan 27th, 2005 |
| Replies: 7 Views: 2,714 I am sorry, I did'nt know how to use the code tag. Now I do...here it is again:
typedef struct node *link;
struct node { itemType item; link next; };
typedef link Node;
void initNodes(int);... |
Forum: C Jan 27th, 2005 |
| Replies: 7 Views: 2,714 My list.h is as follows:
typedef struct node *link;
struct node { itemType item; link next; };
typedef link Node;
void initNodes(int);
link newNode(int);
void freeNode(link);
void... |
Forum: C Jan 26th, 2005 |
| Replies: 7 Views: 2,714 To be frank, I am new to programming and I am learning C while reading Robert Sedgewick's Algorithms in C (3rd Ed). The code was taken from pg 102. It was mentioned in the book that I should save... |
Forum: C Jan 26th, 2005 |
| Replies: 7 Views: 2,714 I have the following list-processing interface which I save as .h file.
I don't see anything wrong with it but everytime I compile, it says that the
declaration in line 2 is missing... |