Search:

Type: Posts; User: newlearner

Search: Search took 0.00 seconds.

  1. Replies
    9
    Views
    1,414

    Yes, but why did the loader only complain about...

    Yes, but why did the loader only complain about "bar" being defined multiple times and not "foo"?
  2. Replies
    9
    Views
    1,414

    @Spidey, yes I meant I made the typo while typing...

    @Spidey, yes I meant I made the typo while typing the post. Sorry for not being clear.
    @Elysia, excellent trick. I was looking through some source code of other projects and found a way to make your...
  3. Replies
    13
    Views
    6,813

    Use the atoi function? And then just shift bits?...

    Use the atoi function? And then just shift bits?


    unsigned int hex = atoll(hexdata);
    for (i = 0; i < 4; i++)
    sprintf(data[i], "0x%x", (hex >> ((3-i) * 8)) & 0xff);

    EDIT: changed atoi to...
  4. Replies
    9
    Views
    1,414

    Sorry my mistake....typo in writing out code....

    Sorry my mistake....typo in writing out code. Thanks for catching that.
  5. Replies
    9
    Views
    1,414

    Macro/globals question

    Hi,

    I have a globals header that contains all my global variables and constants. The basic layout looks like this:

    #ifndef _GLOBALS_H_
    #define _GLOBALS_H_

    int foo;

    const int bar = 2;
  6. Replies
    3
    Views
    959

    Follow Spidey's suggestion...one tip I will give...

    Follow Spidey's suggestion...one tip I will give you is the atoi function which takes in a string like "32" and converts it to the int 32.
  7. Replies
    10
    Views
    1,162

    Thanks guys. Yeah, as many of you have guess the...

    Thanks guys. Yeah, as many of you have guess the code I presented is basically how the offsetof macro is defined sometimes. I was just trying to figure out how it worked. Thanks for all those that...
  8. Replies
    10
    Views
    1,162

    Question about -> dereferencing

    Hi,



    struct blah {
    int a;
    int b;
    };
    struct blah *tmp = (struct blah *) 0;
    printf("%p\n", &tmp->b);
Results 1 to 8 of 8