Search:

Type: Posts; User: aghast

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Compilers, especially the Visual Studio compiler,...

    Compilers, especially the Visual Studio compiler, generally have very precise error messages. It may be that the compiler is confused about something, or that you are confused about something, but...
  2. Replies
    15
    Views
    365

    This sounds like you are missing some fundamental...

    This sounds like you are missing some fundamental definitions.

    I don't know anything about the code you are using, but I suspect that there is some header file you are supposed to include to...
  3. Thread: macros???

    by aghast
    Replies
    4
    Views
    264

    If you are going to do this, you have a couple of...

    If you are going to do this, you have a couple of choices.

    First, would be a preprocessor macro. Something like:




    #define sendmsg(wc) sendmsg(hwnd, WM_SETTEXT, wcharlength, wc)
  4. Replies
    20
    Views
    697

    Suppose you are reading data from a file. The...

    Suppose you are reading data from a file.

    The data are in records. Each record includes name, address, postal code, phone, etc., mostly on separate lines.

    The first line of the file is an...
  5. Replies
    20
    Views
    654

    Is this a bug? err = ArgHasIssue( prv,...

    Is this a bug?


    err = ArgHasIssue( prv, NULL );

    if ( err )
    return ArgHadIssue( err, arg );
  6. Building on what @Salem has said, try changing...

    Building on what @Salem has said, try changing your `main` function like this:

    char buffer[] = "cat is out roaming";

    function(buffer);

    This uses the string literal to initialize...
  7. Replies
    37
    Views
    2,039

    I think what @OP is asking for is how to get rid...

    I think what @OP is asking for is how to get rid of the the title bar of the console window started to run the program.

    And I think the best answer is "you can't do that."
  8. You may choose to use either a for loop or a...

    You may choose to use either a for loop or a while loop on this problem.

    Reasons to use a for loop include:

    * it's a monotonic integer sequence
    * it has a known starting and ending...
  9. Replies
    9
    Views
    824

    The term used in C programming is "file scope."...

    The term used in C programming is "file scope." Variables declared outside of all functions, and functions themselves, are considered to be "objects with file scope."

    However, there's a little...
  10. Replies
    3
    Views
    700

    I don't think you want that as two loops, because...

    I don't think you want that as two loops, because that would change the behavior in ways you don't expect. However, you could factor the "high" variable out as a function of the "low" variable:


    ...
  11. Replies
    2
    Views
    454

    I'm going to assume that you're trying to compare...

    I'm going to assume that you're trying to compare "every element to every other element" or some such. This is a use case that occurs frequently in dealing with arrays.

    To do this, you'll want two...
  12. Your problem statement is a little unclear. If a...

    Your problem statement is a little unclear. If a number has "3 distinct even digits" what does that say about the remaining digits? Could the extra digits also be even, or must they be odd? Are the...
  13. Replies
    2
    Views
    611

    Also, you need to have a tracking variable, to...

    Also, you need to have a tracking variable, to scan through the loop and remember which was the greatest sum. Something like this:



    int tracking_variable = 0;
    for (... loop ...) {
    result...
  14. Replies
    7
    Views
    856

    I believe that returning the result of a...

    I believe that returning the result of a comparison or boolean operation is exactly the right thing to do, if the function you are writing is a predicate.

    That is:



    bool is_lower(int ch)...
  15. Replies
    4
    Views
    578

    First, write a test function: bool ...

    First, write a test function:



    bool
    arrays_equal(int *a1, size_t len. int * a2)
    {
    if (NULL == a1 || NULL == a2)
    return len == 0; // equal for 0 elts, otherwise not equal
  16. Don't worry about it. Calling code should be...

    Don't worry about it.

    Calling code should be bounds checked by correct construction, not by adding checks:

    for (int i = 0; i < length(array); ++i)

    This avoids the need for any kind of...
  17. Replies
    2
    Views
    458

    I would be wary of trying to down-size a hash...

    I would be wary of trying to down-size a hash table. First, because I'm not sure when you would need it: would it be easier to wait and destroy the whole thing?

    Second, because if you shrink it,...
  18. Thread: FIFO Queue

    by aghast
    Replies
    21
    Views
    1,582

    Okay, but ... First, let's talk about...

    Okay, but ...

    First, let's talk about notation:



    (*q).data[0] = data;

    q->data[0] = data;
  19. Replies
    5
    Views
    625

    I already did: to make it circular, follow the...

    I already did: to make it circular, follow the next pointers until you are almost back where you started. Then insert your new value.

    Start with the simple case: how do you insert a single new...
  20. Replies
    5
    Views
    625

    For a list to be circular, you have to be able to...

    For a list to be circular, you have to be able to start as some point P, and follow the list in a single direction, and eventually end up back at the very same point P.

    Your example code is not...
  21. Replies
    21
    Views
    1,903

    For the sieve version, have you tried putting the...

    For the sieve version, have you tried putting the table generator in a separate thread, and allowing the primes to wait on generation? Actually, maybe several threads? (If you're using bool entries...
  22. Replies
    7
    Views
    1,055

    This looks to me like a 24-bit number being...

    This looks to me like a 24-bit number being shifted in two parts.

    The first pair of LDA's gets the upper 16 bits, shifts 2, stores a byte. The next pairs of LDA's gets the lower 16 bits, shifts 2,...
  23. Thread: FIFO Queue

    by aghast
    Replies
    21
    Views
    1,582

    When you are seated at a table in a restaurant,...

    When you are seated at a table in a restaurant, what does the table look like?

    That's what queueInit() does. It "sets the table." It doesn't know who is going to eat, or how many, or what they...
  24. Replies
    3
    Views
    642

    When you pass a value as an argument to a C...

    When you pass a value as an argument to a C function, it is passed "by value". That is, a byte-for-byte copy of the value of the argument is placed on the call stack or in a register, where the...
  25. Replies
    7
    Views
    1,055

    If these functions aren't defined for you, then...

    If these functions aren't defined for you, then you'll need to write them yourself. I'd suggest that you create a bunch of "low level" functions in a header file, using the pre-processor to select...
Results 1 to 25 of 44
Page 1 of 2 1 2