Search:

Type: Posts; User: laserlight

Page 1 of 20 1 2 3 4

Search: Search took 0.12 seconds; generated 40 minute(s) ago.

  1. Replies
    2
    Views
    68

    What are the compile errors and what do you think...

    What are the compile errors and what do you think they mean?

    By the way, I'd get rid of IsFull: it is fairly useless as far as normal usage will go: your linked list grows dynamically, so it...
  2. Replies
    47
    Views
    865

    The idea is that if you have a list of 49...

    The idea is that if you have a list of 49 numbers, to select the first 6 numbers at random without replacement, you do a partial shuffle such that the first 6 numbers out of the 49 are done with the...
  3. Replies
    1
    Views
    74

    Use a debugger to set breakpoints and step...

    Use a debugger to set breakpoints and step through your code. From there, you will be able to narrow down where the infinite loop is happening, and hopefully that will be enough insight for you to...
  4. What's your best try?

    What's your best try?
  5. Replies
    1
    Views
    89

    This is not a way to access the members, but to...

    This is not a way to access the members, but to initialise them by name.
  6. Replies
    4
    Views
    134

    You would do something like what the printf...

    You would do something like what the printf family of functions does: have a known parameter that describes the types of the variable arguments. In the case of printf, it is a format string with...
  7. Replies
    1
    Views
    97

    In this context, i.e., when they are used...

    In this context, i.e., when they are used standalone, there is effectively no difference. The differences only matter when they are used as part of a larger expression.
  8. Replies
    4
    Views
    163

    It stores the address of the structure object. ...

    It stores the address of the structure object.

    This address is the same in value as one of the members of the struct object (i.e., the first) because the struct object consists of these members,...
  9. Replies
    6
    Views
    131

    "excess elements in array initializer" sounds...

    "excess elements in array initializer" sounds pretty straightforward: you're trying to initialise the array with too many elements. For example, in this case you declared the array as an...
  10. Replies
    8
    Views
    364

    Search the Web for a JSON parser for C++

    Search the Web for a JSON parser for C++
  11. Almost. To be consistent, the last printf should...

    Almost. To be consistent, the last printf should be:

    printf(" n = %p \n", n);
    Also, technically the argument corresponding to %p should be a void*, so you may see:

    printf(" n = %p \n",...
  12. Look at this example that you yourself wrote: ...

    Look at this example that you yourself wrote:

    int fun ( int *p )
    {
    *p = 20;

    return p;
    }
    Here is the same function, but with the place in the syntax where the return type is...
  13. Check the return type of the function. Is it a...

    Check the return type of the function. Is it a pointer type? If yes, then the function returns a pointer.
  14. Replies
    6
    Views
    150

    At the top of foo.c, declare x: extern int x;...

    At the top of foo.c, declare x:

    extern int x;

    You also need to #include <stdio.h> in foo.c
  15. Only mathematically. In this context, 20 is an...

    Only mathematically. In this context, 20 is an int, whereas 0061FF28 is an address (i.e., the value of a pointer). The function is declared as returning an int, not a pointer.


    Since you want to...
  16. Replies
    6
    Views
    150

    Yes, a global variable indeed has global scope,...

    Yes, a global variable indeed has global scope, i.e., every use of that name that has not been shadowed by another variable whose name has a more local scope refers to that global variable.
  17. Replies
    4
    Views
    142

    "Hello" is a string constant because it is a...

    "Hello" is a string constant because it is a string constant by definition. Likewise, in this program below, 123 is an integer constant because it is an integer constant by definition, no const...
  18. Replies
    4
    Views
    142

    "Hello" is a string constant, so it exists...

    "Hello" is a string constant, so it exists independently of the pointer.
  19. Replies
    5
    Views
    272

    The simple answer is that you're looking at the...

    The simple answer is that you're looking at the effects of undefined behaviour because accessing an array out of bounds is undefined behaviour. Going deeper, it could be that you were modifying other...
  20. Replies
    2
    Views
    90

    You need to call the function through the...

    You need to call the function through the function pointer:

    (*execute)();
    It should also be possible to omit the explicit dereference as a form of syntactic sugar:

    execute();
  21. Replies
    5
    Views
    272

    Your idea of creating a new dynamic array and...

    Your idea of creating a new dynamic array and copying over the old one to it each time you add a grade is rather expensive: instead of taking amortised constant time, addGrade will take linear time,...
  22. Replies
    47
    Views
    865

    Think about picking one of four restaurants to...

    Think about picking one of four restaurants to eat at for lunch using a single roll of a six-sided die: if you use the entire range of the die using modulo, then two of the restaurants will be twice...
  23. Replies
    47
    Views
    865

    The code desperately needs to be formatted...

    The code desperately needs to be formatted properly and use descriptive variable names where appropriate, and possibly broken up into smaller functions that do one thing and do it well.

    But more...
  24. * moved to Tech Board *

    * moved to Tech Board *
  25. After you replace "class" with "struct", it's...

    After you replace "class" with "struct", it's even simpler because friendship, references, and parents don't exist in C, and you don't have to worry about the case where a member function that is...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4