thanks for your response! unfortunately, I don't have a lot of time, so I don't think I can write out all those inserting removal functions. Also, I'm avoiding creating new lists, because each of my...
Type: Posts; User: coni
thanks for your response! unfortunately, I don't have a lot of time, so I don't think I can write out all those inserting removal functions. Also, I'm avoiding creating new lists, because each of my...
I am trying to write to files called something that I give in my command-line. For example I call "a.out blahblah.c16", and then I want to create two new strings "blahblah.o" and "blahblah.syms" and...
I'm writing an inplace quicksort for linked lists, but I seem to have a bug. I don't know if it's because I changed the structure of my list, but it shouldn't be? I'm infinite looping.
here is...
ok so I have mostly everything fixed now. I realized that I had been reusing the same char array and setting pointers to it, so it changed when I read in the next word. To fix that I used a strcopy...
ok so I'm starting over and combining some code I wrote before:
processLines.c (has main)
#include <stdio.h>
#include <ctype.h>
#include "table.h"
#define MAXLINELEN 100
#define...
I think something in my printTable() is messing it up:
void printTable (struct table * symbols, FILE * out) {
struct entry *n = symbols->first;
printf("%s\n",...
but I haven't used malloc in this function?
ok I fixed the '\0' problem by adding two more cases:
int processLine(char *s, int linecount, struct table *p) {
printf("string is %s\n", s);
char words[MAXSYMBOL];
char* word = words;
thanks for all the help I've gotten! it's very useful.
now I'm writing a processLines that will assign each word in a line read in to addDef or addUse to add to my table.
processLines
...
ok so I made all those fixes, and now I'm writing another function addUse, which adds a node containing a number to the *occur list of entry objects to the table.
struct table * addUse (char...
wow ok fixing the warnings seemed to have worked. thanks!
what do you mean I have to free the malloc? I want to add to the linked list so how else would I keep creating new nodes and add to the...
hmm I don't know if that makes a difference... I was checking the addresses of the places where the first->symbol is stored, when I have this in addDef
printf("2should be word1 %d\n",...
I'm writing a header files and I must be allocating the space wrong because I'm trying to do a linked list but the nodes keep changing.
table.h (some of these I haven't written yet)
#ifndef...
ah ok that's what I'd thought. thanks for your help!
ok I fixed the table.c --> table.h but now I'm getting a "storage size of t isn't known" for the line "struct table t" in my tabletest.c
I thought I had to put the struct table; line in the header...
I keep getting this error when I try to compile three files at once:
gcc table.h table.c tabletest.c
tabletest.c:5: warning: return type defaults to âintâ
tabletest.c: In function âmainâ:...