Search:

Type: Posts; User: laserlight

Page 1 of 20 1 2 3 4

Search: Search took 0.18 seconds.

  1. You don't have to use Code Blocks if you're...

    You don't have to use Code Blocks if you're having trouble getting ot installed; just use something else of your choice that's updated and works with gcc or whatever compiler you choose.
  2. Replies
    7
    Views
    455

    RCC_BASE_ADDR is a macro, so after macro...

    RCC_BASE_ADDR is a macro, so after macro replacement, it is as if you had written:

    p = (uint32_t *)(&0x40023800U);
  3. Replies
    7
    Views
    455

    They are not equivalent, so you might want to...

    They are not equivalent, so you might want to change instructor if that's what the instructor told you.

    To elaborate: the second method treats the int value as the address of an int. So pA does...
  4. I'd say no: you do have to define two in the same...

    I'd say no: you do have to define two in the same translation unit as one in order for it to be static/have internal linkage and yet called by one. A compromise solution might be to make use of a...
  5. This is wrong because you have a local variable...

    This is wrong because you have a local variable for the new local: that variable ceases to exist after the function returns. You could make it static, but then all you'll ever have is one variable,...
  6. What is a "pattern"?

    What is a "pattern"?
  7. Replies
    27
    Views
    818

    I don't see why that is so.

    I don't see why that is so.
  8. Replies
    27
    Views
    818

    That's great! If we apply what you wrote to your...

    That's great! If we apply what you wrote to your more complex problem with linked lists though, what you're doing is equivalent to doing deep copying. Granted, in this simplified version it is...
  9. Replies
    27
    Views
    818

    So what I am suggesting is this: attempt a...

    So what I am suggesting is this: attempt a simpler version of what you're trying to solve, and show us how you do it. Forget about linked lists for now, and focus on the notion of implementing...
  10. You're right: they match. It may make no...

    You're right: they match.

    It may make no difference, but I suggest that you remove the using declaration from the header file: fully qualify std::string there instead. In the source file, move the...
  11. Replies
    27
    Views
    818

    Wait. This is an extremely simple version of the...

    Wait. This is an extremely simple version of the complex problem that you're trying to solve. If you cannot implement the simple version, then you have no hope of implementing the complex version, so...
  12. Replies
    27
    Views
    818

    Great, that's good information to work with....

    Great, that's good information to work with. Let's simplify and imagine that you're dealing with this number type:

    typedef struct number
    {
    int value;
    } number;

    number *add(number *x,...
  13. Replies
    27
    Views
    818

    The first thing that I suggest is for you to get...

    The first thing that I suggest is for you to get rid of those typedefs, i.e., this:

    typedef struct node { double coefficient, power;
    struct node *Previous, *Next;
    } *equationList;
    ...
  14. Replies
    27
    Views
    818

    Sure, but you'll have to post the code here. ...

    Sure, but you'll have to post the code here.

    I don't see what's so difficult though. You already have an idea of how identify whether you need to copy, i.e., ask yourself if you need the original...
  15. Replies
    27
    Views
    818

    Maybe, maybe not. It depends on your...

    Maybe, maybe not. It depends on your requirements. For example, suppose that you want to operate on a linked list, thereby changing it, but you also want to retain the original state of the linked...
  16. Replies
    27
    Views
    818

    So, you want to pass the linked list to a...

    So, you want to pass the linked list to a function and modify it while keeping it unmodified in the caller. This means that you must make a copy of the linked list so that you can modify the copy,...
  17. Replies
    27
    Views
    818

    This is wrong: struct node *L = (struct node...

    This is wrong:

    struct node *L = (struct node *)malloc(sizeof(struct node*));
    It should be:

    struct node *L = malloc(sizeof(*L));
    That is, you were allocating space for a pointer when you want...
  18. Replies
    27
    Views
    818

    If the linked list is represented by a pointer to...

    If the linked list is represented by a pointer to the head node only, then pass a pointer to that head node. You may need to return a pointer to the resulting head node, or pass a pointer to a...
  19. You might want to revise your learning material...

    You might want to revise your learning material on pre-increment versus post-increment; you may have mixed them up hence the confusion.
  20. Replies
    7
    Views
    483

    You just haven't found it yet. What IDE and/or...

    You just haven't found it yet. What IDE and/or compiler are you using?


    Try to compile this program:

    #include <stdio.h>

    int main(void)
    {
    printf("hello
  21. Remember, the first identifier is the macro name,...

    Remember, the first identifier is the macro name, and the rest is what the macro consists of. So, this doesn't set the LED_Set macro; this sets the LED_Off macro to LED_Set. This way, you can use the...
  22. Replies
    7
    Views
    483

    ... but not at the same time. You have to pick a...

    ... but not at the same time. You have to pick a language: do you want to write this program in C or in C++?

    Also, read Stroustrup's answer to the FAQ: What do you think of C/C++?

    As for the...
  23. Replies
    2
    Views
    383

    It doesn't look like you have a dynamic array:...

    It doesn't look like you have a dynamic array: you allocated space for just one music object.

    I'd get rid of the countLines function: you can count while reading, and you should only do so once.
  24. You could have a buffer overflow elsewhere that...

    You could have a buffer overflow elsewhere that is corrupting memory, and so it looks like the problem is with this function when it is actually elsewhere.
  25. You have to recognise that in this function: ...

    You have to recognise that in this function:

    void foo(char s[10]) {}
    The parameter named s is a pointer, not an array. The 10 indicates that the pointer is expected to point to the first char in...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4