so how do i allocate space? do i need to call calloc on it?
also, is there any reason why the program doesnt run the whole way through
thanks
Type: Posts; User: dacbo
so how do i allocate space? do i need to call calloc on it?
also, is there any reason why the program doesnt run the whole way through
thanks
I have posted about this program before and I thought I had it sorted but it appears I've run into trouble again. I'm makinga program that reads in a text file, reads it and enters all of the words...
thanks for your help guys
stupid mistakes on those typos
have since rewritten using fgetc()
I'm trying to read a text file in C and insert all of the words in the file to a linked list which will then later be traversed.
I've coded my program to take a file specified at the command line,...
yeah makes sense, cheers
ahah, thanks very much for your help - thats done it
stupid mistake by the looks of it :)
have modified the program as you said which has fixed my problem but I'm now getting segmentation faults with my makelower function
am I calling and compairing s[n] in the right way?
i'll give that article a read, cheers
and no I didnt know that I don't free the string - maybe i should do that?
I'm building a program that searches a tree for a name and then outputs their phone number. The program all works well I need to make it ignore the case of the search input when searching for a...
yeah i've tried e as both a pointer and not a pointer, it still has the same pointer
edit: maybe not, this seems to have fixed it
cheers
need some help with trees, basically I'm building a tree of people with names and phone numbers which will then be searched, however i keep having problems with the insert function which causes...
ah cheers thats great
and just to check, fgets is a standard C function yeah? no C++ in there?
hmm yeah but I cant seem to find any better way of doing it unless someone has a better idea?
ok it works now by using the gets() feature
i've set the size of the name array to be 100 chars so there should be no problems with overflow
thoughts?
yup fixed that but it still waits until 30 characters (including carriage returns) have been inputted before finishing the function
ok i've written a new function using getchar()...
char name[30];
int n=0;
while (n <=30 && name[n] != '\n') {
name[n] = getchar();
n++;
}
Ok this question probably has a simple answer but I currently can't find any answers on here or google.
I'm relatively new to C but have experience in other programming languages.
I'm writing a...