Search:

Type: Posts; User: james123

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    7,830

    Signed hex conversion

    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...
  2. Replies
    0
    Views
    1,372

    Tree Pattern Matching

    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...
  3. Thanks to both of you for explaining that - I...

    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...
  4. ooops, yer you're right there was supposed to be...

    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...
  5. dwks: Just seen your post and it looks like it...

    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...
  6. I'm using gcc on windows with the following...

    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...
  7. This was what I tried originally however I got...

    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...
  8. Passing an array or pointers to the same function as a pointer

    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...
  9. Replies
    1
    Views
    4,695

    Dynamic Hash Table Implementation

    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...
  10. Replies
    4
    Views
    1,694

    Thanks to everyone who has replied - I went for...

    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...
  11. Replies
    4
    Views
    1,694

    Basic pointer question

    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:

    ...
  12. Right, I understand now - I keep getting caught...

    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...
  13. Hi again, I've just tried what I think you...

    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...
  14. Quzah: Thanks, I see what I'm doing wrong now - I...

    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...
  15. Struct variables getting overwritten when writing to local variables

    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...
  16. Replies
    4
    Views
    1,705

    That did the trick, thanks alot! I've been...

    That did the trick, thanks alot! I've been tearing my hair out over this for ages!

    James
  17. Replies
    4
    Views
    1,705

    I could well be... basically I want to read in...

    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?
  18. Replies
    4
    Views
    1,705

    looping to get user input

    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...
  19. Replies
    4
    Views
    1,112

    Excellent, thanks to both of you who replied....

    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
  20. Replies
    4
    Views
    1,112

    Thanks for the quick reply! I have tried this and...

    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...
  21. Replies
    4
    Views
    1,112

    Character pointer problem

    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...
Results 1 to 21 of 21