Search:

Type: Posts; User: laserlight

Page 1 of 20 1 2 3 4

Search: Search took 0.17 seconds; generated 11 minute(s) ago.

  1. Replies
    2
    Views
    81

    You might want to elaborate on this. For example,...

    You might want to elaborate on this. For example, by "set" you presumably mean a set of values on a line. Do you want to sort the values within each set? Do you want to sort the sets themselves with...
  2. Replies
    1
    Views
    105

    You need to construct the filename from the...

    You need to construct the filename from the command line argument, e.g., by creating an array of char large enough to hold the result, then copying the command line argument followed by ".txt".
  3. It sounds like this is the problem text rather...

    It sounds like this is the problem text rather than a paraphrase: "The numbers must be separated from other words by at least one whitespace."

    If so, "word" in this context is used to mean...
  4. Yes, and of the same type.

    Yes, and of the same type.
  5. This: (&x)[i] is equivalent to: *(&x + i)...

    This:

    (&x)[i]
    is equivalent to:

    *(&x + i)
    Suppose i == 0, then we end up with:

    *(&x + 0)
    which is equivalent to:
  6. Instead of parsing the number yourself, I wonder...

    Instead of parsing the number yourself, I wonder if it will be easier to "cheat" by replacing the comma, if one exists, with a period, then calling something like strtod.
  7. Declare the array in the caller and pass a...

    Declare the array in the caller and pass a pointer to the array as an argument when calling the function. It is also wise to have a parameter for the size of the array.

    Alternatively, you can use...
  8. Post in a new thread since it is unrelated.

    Post in a new thread since it is unrelated.
  9. Replies
    4
    Views
    127

    What is the version of g++ that you're using? I...

    What is the version of g++ that you're using? I believe g++ has defaulted to C++11 or later for a few major versions now, e.g., a quick check shows g++ 6.5 will default to the GNU dialect of C++14.
  10. Oh, but that wouldn't help you understand the...

    Oh, but that wouldn't help you understand the code flow, if by that you mean the flow of control through the program. That would be done by tracing function call graphs rather than by finding all...
  11. Replies
    4
    Views
    127

    Wait, so you're not compiling with respect to...

    Wait, so you're not compiling with respect to C++11 or later?
  12. Why do you want to find all calls of that method?...

    Why do you want to find all calls of that method? Usually I'd imagine it is to perform a rename, and your IDE may have a specific refactoring tool for that, but then indirect invocation of the method...
  13. Replies
    8
    Views
    199

    That's what I had in mind when I wrote that "just...

    That's what I had in mind when I wrote that "just that certain implementations may permit it for their own use cases".


    No, just assigning an arbitrary address without doing pointer arithmetic is...
  14. Replies
    8
    Views
    199

    The rule that you might be thinking of is the one...

    The rule that you might be thinking of is the one about pointer arithmetic with respect to the elements of an array: in such a case the standard defines addition of an integer to a pointer such that...
  15. Replies
    19
    Views
    471

    On the contrary, you do have to declare variables...

    On the contrary, you do have to declare variables before assigning to them (or from them, for that matter).

    Anyway, the reason why john.c is facepalming so hard is that the tutorial that Salem was...
  16. Replies
    19
    Views
    471

    oods1, do you have a computer programming...

    oods1, do you have a computer programming background, and are you familiar with the C programming language?
  17. Replies
    3
    Views
    195

    If you're willing to use the non-standard but...

    If you're willing to use the non-standard but POSIX-standard getline function, then life is somewhat easier:

    char *line = NULL;
    size_t len = 0;
    if (getline(&line, &len, stdin) != -1)
    {
    //...
  18. No, let's take a look at this line: ...

    No, let's take a look at this line:

    *(ptr_arr+i) = word;
    it would be slightly easier if we transformed it to use array notation:

    ptr_arr[i] = word;
    ptr_arr[i] is an int, whereas word is a...
  19. Replies
    8
    Views
    278

    I would start by defining a function to print a...

    I would start by defining a function to print a single employee's data:

    void print_employee(FILE *fp, const Employee *employee);
    I would manually create an Employee object and test this...
  20. Your compiler is right: to compute the height,...

    Your compiler is right: to compute the height, you don't need to modify the struct object, therefore this:

    int vertexheight(struct parabola * p, double *y);
    should have been:

    int...
  21. The easiest may well be to just compare the...

    The easiest may well be to just compare the characters:

    if (a[4] == 'J' && a[13] == 'R')
    If you really want to form a string out of them:

    char sample[3] = "";
    sample[0] = a[4];
    sample[1] =...
  22. Thread: memcmp ?

    by laserlight
    Replies
    6
    Views
    245

    Write the loop and place it in a function that...

    Write the loop and place it in a function that returns a value that you can then check in a conditional. Problem solved.
  23. Replies
    1
    Views
    142

    Just work with 16 characters at a time. It...

    Just work with 16 characters at a time. It wouldn't be a null terminated string, but you probably don't need that for encryption.
  24. That implies that the array of pointers is an...

    That implies that the array of pointers is an array of char pointers (i.e., char*[N]), which means that the parameter should be a pointer to a pointer to char (i.e., char**).


    By using pointers....
  25. Replies
    2
    Views
    190

    Your swap is wrong: it should be of the form: ...

    Your swap is wrong: it should be of the form:

    temp = x;
    x = y;
    y = temp;
    The next problem is that you need to swap with a pointer that doesn't have the '-' prefix, not with a fixed pointer....
Results 1 to 25 of 497
Page 1 of 20 1 2 3 4