Search:

Type: Posts; User: laserlight

Page 1 of 20 1 2 3 4

Search: Search took 0.22 seconds; generated 47 minute(s) ago.

  1. Instead of a default argument, add a...

    Instead of a default argument, add a two-parameter overload that forwards to the three-parameter version:

    char* function(char* a, int b, char** c) {
    // ...
    }

    char* function(char* a, int...
  2. Replies
    4
    Views
    162

    Those aren't tokens though. After lexical...

    Those aren't tokens though. After lexical analysis, the tokens would be "j", "=", "+", "3" for the former. The parser would then parse and understand that the adjacent tokens "+" and "3" are grouped...
  3. Replies
    1
    Views
    78

    Do that, followed by a statement (also in the...

    Do that, followed by a statement (also in the else block) with the break keyword.
  4. Replies
    3
    Views
    104

    Where did you allocate space for the struct...

    Where did you allocate space for the struct person object?
  5. Replies
    3
    Views
    106

    So... you understand what's going on now?

    So... you understand what's going on now?
  6. Replies
    3
    Views
    106

    pointer[i] is an int; &array[i] is a pointer to...

    pointer[i] is an int; &array[i] is a pointer to int. How could they be the same thing?
  7. Replies
    3
    Views
    143

    You did so successfully. What you didn't do...

    You did so successfully.

    What you didn't do successfully was trying to access a member specific to derived classes on the elements of a vector of base class smart pointers:

    for(const auto& v :...
  8. * moved to C++ programming forum *

    * moved to C++ programming forum *
  9. Replies
    4
    Views
    123

    Explain why you have such a doubt.

    Explain why you have such a doubt.
  10. Replies
    4
    Views
    123

    Just print the pointer whose value was returned...

    Just print the pointer whose value was returned by malloc:

    printf(" address : %p \n", (void*)st);
  11. You're basically creating an object merely to...

    You're basically creating an object merely to serve as documentation, and it really is just documentation as you could have just as easily written by mistake:

    Character Knight("Knight",...
  12. Replies
    2
    Views
    126

    Draw on paper a singly linked list with say, 4...

    Draw on paper a singly linked list with say, 4 nodes. Pick a node and think about how you might go about doing it. Pick another node, say the first and last and go through how you would delete it....
  13. If you want to use st, why are you still...

    If you want to use st, why are you still declaring and using p1?
  14. Err... N is just a member of the struct. It...

    Err... N is just a member of the struct. It doesn't tell you how much memory has been allocated. Furthermore, you printed its value before assigning it an initial value, so you got garbage.
  15. Actually, we always dynamically allocate memory...

    Actually, we always dynamically allocate memory for objects, where an object is some region of memory storing a value of some type. So, an object could be of pointer type, of some struct type, of...
  16. Why do you want to dynamically allocate memory?

    Why do you want to dynamically allocate memory?
  17. Replies
    4
    Views
    214

    Oh dear, my apologies, my turn to not see that...

    Oh dear, my apologies, my turn to not see that this was posted in the C programming forum. The C++11 rules are likely to be consistent with C99 though as that's the C++11 reference for constructs...
  18. Replies
    4
    Views
    214

    Both of these are directly addressed by the C++...

    Both of these are directly addressed by the C++ standard:

    So, 2 >> -1 results in undefined behaviour, 2 >> 5 results in zero, and -2 >> 1 has an implementation-defined result.


    Both of these...
  19. Replies
    7
    Views
    209

    Yes, except that your problem has to do with you...

    Yes, except that your problem has to do with you mixing up a function declaration versus a function call.


    Thankfully, multiple errors are sometimes due to the same mistake. Take these four...
  20. Replies
    2
    Views
    150

    Your first struct declaration is not...

    Your first struct declaration is not syntactically correct in the first place. Perhaps what you wanted to do was this:

    struct student {
    char name[30];
    int rollNo;
    struct dateOfBirth...
  21. Since you're using such a recent IDE with a...

    Since you're using such a recent IDE with a compiler that supports C++17, have you considered using the standard filesystem library instead?
  22. Replies
    9
    Views
    142

    The second is probably better: you can just take...

    The second is probably better: you can just take the address of the local variable at the end. No need to worry about unique_ptr and even think about memory management.
  23. Replies
    9
    Views
    142

    Yes, but then you won't meet your "create struct...

    Yes, but then you won't meet your "create struct instance on heap" requirement.
  24. That is with respect to the specific claim that...

    That is with respect to the specific claim that "It's easy to represent 100 lines of (...) Python, (...) code in just 1 line of Rapid Euphoria". According to the example that you gave, it isn't. For...
  25. Replies
    14
    Views
    230

    You could say that, but it would be more accurate...

    You could say that, but it would be more accurate to say that you allocated memory for what i points to.


    Just remember that since i is a pointer to int, *i is an int, so you assign to the int...
Results 1 to 25 of 494
Page 1 of 20 1 2 3 4