I need to be able to convert hex values to a signed integer. I'm currently using the below:
strtol(data, NULL, 16);
but when data is equal to something like 'FFFFFE' the result comes out to be...
Type: Posts; User: james123
I need to be able to convert hex values to a signed integer. I'm currently using the below:
strtol(data, NULL, 16);
but when data is equal to something like 'FFFFFE' the result comes out to be...
Hi all,
I've been looking for a simple tree pattern matching algorithm however all the ones I have found so far seem too complex for my needs. I'm not worried about run time at the moment, I just...
Thanks to both of you for explaining that - I thought the build_ds prototype looked pretty ugly! It's been a long day so I'll try your suggestions in the morning and see if i can figure it out with...
ooops, yer you're right there was supposed to be another * on the table_add. This would allow me to pass a pointer to an array of pointers but stops me from passing it as an argument to the build_ds...
dwks:
Just seen your post and it looks like it does what i need. The only thing I don't follow is:
typedef void (*print_t)(void *array, int elements);
I've never used typedef so not...
I'm using gcc on windows with the following flags: -Wall -Wextra -pedantic -ansi
I have two seperate functions for adding data to the data structures (same linked list functions for hash table...
This was what I tried originally however I got errors saying the pointer type was incompatible. I tried doing a cast '(struct list_node *)' but this still didn't work. It all works fine except for...
Hi all,
I'm building a program that reads data in from a file and inputs it into both a linked list and hash table (for time comparisons). I have a function to which i pass a file name and a...
Hi all,
I'm working on a hash table that expands in size dynamically as it fills up. Basically when the existing table is a certain percentage (say 90%) full i want to double it in size. I propose...
Thanks to everyone who has replied - I went for Sebastiani's solution because in my real code the function already returns an int value so returning is not an option - This is what I have done in the...
Hi all,
I have what i think should be a very basic question about pointers I just can't seem to get my head around it at the moment! The code below illustrates the problem on a simpler scale:
...
Right, I understand now - I keep getting caught out with not using strcpy! I'm used to programming in PHP which allows you to assign strings using the '=' operator and I'm finding it hard remembering...
Hi again,
I've just tried what I think you suggested - I made my local name an array of characters and then malloc'ed enought space to hold name before using it within my struct however I still...
Quzah: Thanks, I see what I'm doing wrong now - I knew it would be something simple!
C_ntua: Thanks for pointing that out - my real code does include all the correct headers it's just I forgot to...
Hi all,
I'm relatively new to C and can't for the life of me figure out what I'm doing wrong! I have a simple struct setup to create a binary tree with a char * called 'name'. I also have a local...
That did the trick, thanks alot! I've been tearing my hair out over this for ages!
James
I could well be... basically I want to read in one line of data, I thought that was how to read in one line? How would you suggest doing it?
Hi all,
Second newbie question of the day! I'm building a program that gets input from the user. I am using scanf to get a line and then do some processing and this is working fine. The problem...
Excellent, thanks to both of you who replied. I've sorted the problem now using the approach suggested. It seems pretty obvious now you mention it!
Cheers,
James
Thanks for the quick reply! I have tried this and i get a compile error saying 'assignment makes pointer from integer without a cast'. Changing my add_child_node code to:
int...
Hi all,
I'll warn you all now this is my first attempt at programming in C so this is probably a very basic question. Basically I have an n-ary tree which contains a char pointer called value. I...