Search:

Type: Posts; User: laserlight

Page 1 of 20 1 2 3 4

Search: Search took 0.13 seconds; generated 28 minute(s) ago.

  1. You forgot to allocate space for the root node...

    You forgot to allocate space for the root node before you used scanf to read into root->data.
  2. Replies
    8
    Views
    115

    In this revised version of your code, you don't...

    In this revised version of your code, you don't appear to be using cle after reading it. Surely that is a bug since the key is essential to the encryption.
  3. You should not have the member functions do...

    You should not have the member functions do interactive I/O like that.
  4. Replies
    8
    Views
    115

    You didn't post your current code.

    You didn't post your current code.
  5. Replies
    1
    Views
    46

    Both are correct. I mean, you're just regarding...

    Both are correct. I mean, you're just regarding one file as the "first" and the other as the "second", then swapping over the designations in the next example.

    A more common way of doing this is...
  6. Replies
    8
    Views
    115

    What is your current code? Also, post your test...

    What is your current code? Also, post your test input, expected output, and (as far as you can) actual output.
  7. Don't you have examples of that in your learning...

    Don't you have examples of that in your learning material? Your stringP function already does that, except that it is badly named and looks like it isn't correctly implemented.
  8. Err... the return type is right there for you to...

    Err... the return type is right there for you to see: struct student *
  9. If you're talking about how to save the displayed...

    If you're talking about how to save the displayed output to a string: do it in the opposite order, i.e., write a function that generates the required string, then print the string or do whatever else...
  10. Replies
    3
    Views
    93

    I suggest that you post a compilable program...

    I suggest that you post a compilable program rather than just a fragment with unexplained parts. I can make guesses based on what I see, but why guess when you can post the definitions of param_1 and...
  11. Replies
    1
    Views
    65

    Yes, you can, but you may end up injecting more...

    Yes, you can, but you may end up injecting more unqualified names into the scope than you expect, so you shouldn't unless you know what you're doing.
  12. Replies
    7
    Views
    214

    Then don't do that :) The class definition...

    Then don't do that :)

    The class definition should go in the header unless you're trying for the pimpl (opaque pointer) idiom... but in that case in C++ you would still have a class wrapper; it's...
  13. You should not have functions just for the sake...

    You should not have functions just for the sake of having functions. Rather, use functions to simplify repetitive code that should be reused instead, or use them to group sections of code and name...
  14. Replies
    7
    Views
    214

    Post the corresponding error message, don't just...

    Post the corresponding error message, don't just refer to it.

    This compiles for me without even a warning on g++ 7.4.0:

    #include <iostream>
    #include <memory>

    struct Engine
    {
    const...
  15. The address of Ptr->number is &Ptr->number, not...

    The address of Ptr->number is &Ptr->number, not Ptr->number.

    But why do you want to know its address? What's the point? I showed you a simple example in post #8 and asked you two related questions...
  16. Refer to my previous post.

    Refer to my previous post.
  17. Well okay. If you want to clarify what are the...

    Well okay. If you want to clarify what are the addresses of a struct object versus its data members, then yes, that's a good time to print addresses. But it really doesn't have to be so hard:
    ...
  18. Stop bothering with printing addresses/pointers....

    Stop bothering with printing addresses/pointers. If you want to know if space has been allocated by malloc, check that the return value of malloc is not a null pointer. That's all that you need to...
  19. They are the same by definition: the address-of...

    They are the same by definition: the address-of operator & results in a pointer to the operand.

    If you really must, you can do the rather pointless exercise of:

    #include <stdio.h>

    struct...
  20. That's good to know, but you still haven't...

    That's good to know, but you still haven't answered my question, e.g., change it to a vector<string> of two strings, "a" and "b". What would the resulting char be, and how did you arrive at that...
  21. What does it mean to convert a vector to...

    What does it mean to convert a vector<string> to char? For example, suppose you have a vector<string> with two strings, "hello" and "world!". What would the resulting char be, and how did you arrive...
  22. Replies
    3
    Views
    120

    In main.cpp, you have these two lines before the...

    In main.cpp, you have these two lines before the main function:

    std::string input;
    std::string*pInput =&input;
    Get rid of them as they should be in the main function instead, and in fact you do...
  23. It is a bit difficult to see what lines the error...

    It is a bit difficult to see what lines the error messages correspond to. Post the smallest and simplest program that you expect should compile but which demonstrates the errors (this means that you...
  24. 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...
  25. Replies
    4
    Views
    209

    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...
Results 1 to 25 of 494
Page 1 of 20 1 2 3 4