Search:

Type: Posts; User: c_seeker

Search: Search took 0.00 seconds.

  1. Replies
    2
    Views
    1,154

    assembly code translation to c

    Hello,

    I'm working on trying to translate some assembly code into C. I think I correctly interpreted lines 1-3. Could someone explain what lines 4-6 are doing?

    Take line 4, for example. To...
  2. Replies
    3
    Views
    803

    Thanks !

    Thanks !
  3. Replies
    3
    Views
    803

    != NULL question

    Hello,

    I was wondering if these two ways of writing things are always the same in terms of their truth value and what the compiler thinks:



    assert(myStruct->field != NULL);...
  4. which is the proper way to use free in this example?

    Hello,

    Suppose I dynamically create memory for an array in an external function. When using free later, I'm not sure if I should just use free once on the entire array object, or if I am supposed...
  5. Thanks tabstop! This compiled o.k.: int...

    Thanks tabstop!

    This compiled o.k.:



    int main(void){

    char *a;
    a = (char*) malloc (100*sizeof(char));
  6. how do you free a string literal from memory?

    Hello,

    This compiles o.k.:



    int main(void){

    char *a;
    a = (char*) malloc (100*sizeof(char));
  7. Thank you so much for this clarification. It's...

    Thank you so much for this clarification. It's very strange this C stuff! Here is my new code:


    size_t i_want_this_much = 1000;
    int *a = malloc(i_want_this_much * sizeof(*a));

    ...
  8. Thanks for your suggestion. However, so I know I...

    Thanks for your suggestion. However, so I know I am properly allocating memory, I want the computer to tell me the size by actually checking the size, not just recalling a pre-set variable. It's...
  9. my malloc is stuck on "8" for some reason... why?

    Hello,

    I'm trying to keep track of the size of blocks of memory that a pointer points to. No matter what I do, this code below always outputs the integer 8.

    If I change 1000 to 5, I still...
Results 1 to 9 of 9