In working on a problem to solve Huffman coding, I've developed the following simple code to get a table for values in the binary tree, which prints the path from root to leaf. Forgive what I'm sure...
Type: Posts; User: atlantis43
In working on a problem to solve Huffman coding, I've developed the following simple code to get a table for values in the binary tree, which prints the path from root to leaf. Forgive what I'm sure...
finally got the right combination of switches in Makefile to allow gdb to function:
#############################################################################
# Makefile for huffman...
I'll take a look & see if anything works. So far I've tried redoing Makefile in all sorts of combos, and remade file, but still not the right combo. Maybe the links will help.
No luck. With your first suggestion, I get terminal output of:
jharvard@appliance (~/Dropbox/huffman): makegcc sample.o libhuffman.a liboptlist.a -L. -lhuffman -loptlist -03 -o sample
gcc: error:...
In order to understand a program for data compression, I'm trying to step through a program using GDB, and am having a problem setting a breakpoint.The code is all in a single directory, and the...
Thanks to all for clear reply.
As a novice, came across some code which started out as follows, and am wondering why such a "for loop" is used at all? I don't understand the meaning of including what I would interpret logically as...
Thanks for the detailed review of all items in this thread. I thought that I did 'wrap' all code, save for the short descriptive text/explanation of the problem to solve:
Seemed easiest to express...
thanks for quick reply. Just a further question as to freeing such an allocation.
Would this work ?:
while(int i < 26)
free(arr[i]);
wondering if anyone can advise on the above subject.
I've tried starting with the following, but this only works for char array. My array should consist of r strings of strlen <= 25. These strings...
Can someone explain in what order a CPU would process the following arithmetic problem: 5 - (-9) = 14?
Would the CPU recognize that the 'minus a minus' combination simply represents 5 + 9, and...
Glad to see that I at least understood the redundancy of the example cited. I'll still have to give some thought as to the examples that you and WoodSTockk have cited, in order to understand the...
The following code appears in a text regarding bitwise shift operations, with the following descriptive text:
#include <stdio.h>
#define BYTE_MASK 0xff
int main(void)
{
unsigned long...
Nominal Animal;
thanks for your clear & detailed explanation. This, together with the above-mentioned C Programming link should help me undo my ignorance.
This looks like a great link for my purposes (and novice level).
Thanks again.
Guess I have to scrutinize those links (which I've previously seen), but what type of empty variable is needed to hold the bits?
Wouldn't unsigned int be 4 bytes for each of 256 elements: or is...
I'm trying to code a Huffman tree header, with the ADT defined from an old on-line course in C programming. I'm stumped by the following instructions:
I've already made a character-frequency...
Now that I understand, I see how appropriate your post was. I guess I'm just a bit slow.
Oh, enlightenment!
getchar() is consuming all chars remaining in buffer, but continue; only applies for chars other than '\n'. Thanks to all for your aid.
Thanks for including the word "consumed", which helps make some sense of it: but the question remains as to why '\n' is "consumed" even though, in such case, the 'while' condition is false. Is this...
Hope that someone can clarify my confusion with the following common "instructional" code for clearing buffer:
while ( getchar() != '\n') continue;
As per manual,
I understand that such code...
Yup, that corrects the problem. Still don't understand why it gave the consistent additional garbage value = 3 in the output, even after attempts at re-compiling with variations. Any explanation?
In an online exercise, I'm getting an unexpected additional value in my result, which I can't seem to explain.
#include <stdio.h>
#include <stdlib.h>
struct node
{
int i;
struct...
Ok, so I see buttons, but the only usable ones are "debug" and "add watch". All others are greyed out. If I push "Debug", it just runs the code to completion, without giving a chance to step through...
I don't know how to enter gdb commands: eg, 'r', 'b', 'n', 's',etc, or where to enter such commands on the screen window (or, for that matter, how and where to enter parameters, when needed. I'm use...