Search:

Type: Posts; User: ITAmember

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Thread: hash tables

    by ITAmember
    Replies
    15
    Views
    3,043

    I see what you mean, I wasn't sure what a hash...

    I see what you mean, I wasn't sure what a hash table was. :( Anyway, thanks. :) I think I can take it from here.
  2. Thread: hash tables

    by ITAmember
    Replies
    15
    Views
    3,043

    Thank you for clearing that up than. :) The keys...

    Thank you for clearing that up than. :) The keys are not numbers, they are void pointers. So I need a dynamic array not a linked list right?
  3. Thread: hash tables

    by ITAmember
    Replies
    15
    Views
    3,043

    So what is it than?

    So what is it than?
  4. Thread: hash tables

    by ITAmember
    Replies
    15
    Views
    3,043

    Yes you can check if it has the same key, loop...

    Yes you can check if it has the same key, loop through and check keys, if you find a match edit the value instead of adding a new key/value pair.
  5. Thread: hash tables

    by ITAmember
    Replies
    15
    Views
    3,043

    hash tables

    I'm looking to implement my own hash table system. All keys and values will be the same type. (4 bytes) No shared keys/values, every key must me unique and each key will have it's own value. I was...
  6. Replies
    18
    Views
    42,696

    32 bit computers have 32 bit registers. If you...

    32 bit computers have 32 bit registers. If you were to add two 32 bit integers together and the result takes more than 32 bits of space the remainder goes into another register. I don't remember...
  7. Replies
    54
    Views
    8,926

    Ahh, that's the problem. Works great now, many...

    Ahh, that's the problem. Works great now, many thanks. :) I shouldn't have any more problems now as arrays are work basically the same as these strings.
  8. Replies
    54
    Views
    8,926

    Depends, do you have an easier method to...

    Depends, do you have an easier method to implement dynamic typing? This will all be generated code anyway, I'm just trying to figure out how to get it to work.
  9. Replies
    54
    Views
    8,926

    It at least assigns the data now, I just can't...

    It at least assigns the data now, I just can't print the whole string. :( New code:


    memcpy((void*)((int*)test_str+1), "Hello world!", 13);
    printf("the value of test = %s, the type of test =...
  10. Replies
    54
    Views
    8,926

    Technically I'm assigning an array to a typeless...

    Technically I'm assigning an array to a typeless block of memory. :) What I need is just a bulk memory copy function, would memccpy work or is there a better one?
  11. Replies
    54
    Views
    8,926

    I fail again. :( This time it's with C strings....

    I fail again. :( This time it's with C strings. Important code:


    void *test_str = malloc(17);
    *(int*)test_str = 3;
    *(char*)((int*)test_str+1) = "Hello world!"; /* problem line */
    test =...
  12. Replies
    54
    Views
    8,926

    It works! Working code snippet without the...

    It works! Working code snippet without the typedef ((void(*)())*((int*)test+1))(); thank you!
  13. Replies
    54
    Views
    8,926

    Notice the (int*) in ((int*)test+1) casts test to...

    Notice the (int*) in ((int*)test+1) casts test to an int to allow the +1 to move the memory address down 32 bits. That (int*) part is just to get the right memory address. Once I get that memory...
  14. Replies
    54
    Views
    8,926

    Here's the whole code with the relevant code in...

    Here's the whole code with the relevant code in red


    #include <stdio.h>
    #include <stdlib.h>

    void printer()
    {
    printf("in printer\n");
    }
  15. Replies
    54
    Views
    8,926

    After some quick changes it does. :) New code ...

    After some quick changes it does. :) New code

    (*((int*)test+1))();

    Now I get

    error C2064: term does not evaluate to a function taking 0 arguments

    Closer, I still don't get what's up with...
  16. Replies
    54
    Views
    8,926

    ((int*)test+1) gets the memory address where the...

    ((int*)test+1) gets the memory address where the function pointer is stored

    EDIT:

    BTW I'm trying to call printer.
  17. Replies
    54
    Views
    8,926

    Can I use that even though I ditched the structs?...

    Can I use that even though I ditched the structs? Regarding the function pointer problem, I have this code

    *(*printer)()((int*)test+1);

    where printer refers to a function that takes no...
  18. Replies
    5
    Views
    1,301

    This is a gold mine for FAT32 clicky...

    This is a gold mine for FAT32 clicky. just do a google search for "<file system> mbr specifications"
  19. Replies
    54
    Views
    8,926

    Could you explain how I could use it?

    Could you explain how I could use it?
  20. Replies
    54
    Views
    8,926

    Now I want to call a function pointer using the...

    Now I want to call a function pointer using the same method I used on the int and float, here's the relevant code:


    void printer()
    {
    printf("in printer\n");
    }
    ...
    void *test_funcptr =...
  21. Replies
    10
    Views
    2,642

    I realize the shortcommings of my approach. The...

    I realize the shortcommings of my approach. The OP just wanted a faster method without looping through everything. The 3D search would be by far the most flexible and most accurate.
  22. Replies
    10
    Views
    2,642

    You would have this list of color values: ...

    You would have this list of color values:


    (0, 0, 0)
    (0, 0, 1)
    (0, 0, 2)
    (0, 0, 3)
    (0, 0, 4)
    (0, 1, 0)
    (0, 1, 1)
  23. Replies
    10
    Views
    2,642

    I suppose if all the components of your colors...

    I suppose if all the components of your colors were in intervals of, say, 64 you could do simple division. Say your color is (234, 73, 147). you could divide each side by 64 and round to the nearest...
  24. Replies
    10
    Views
    2,642

    alpha regarding color determines the amount of...

    alpha regarding color determines the amount of translucency in the image. kind of like see-through. like the window boarders in vista. 32 bit color depth images have 8 bits for red, green, blue, and...
  25. Replies
    54
    Views
    8,926

    I rewrote the test program to use malloc and void...

    I rewrote the test program to use malloc and void pointers. This should open up new possibilities. I would like you guys to review the code to see if I made any mistakes however. (don't worry, it...
Results 1 to 25 of 73
Page 1 of 3 1 2 3