Search:

Type: Posts; User: aghast

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    37
    Views
    698

    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."
  2. 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...
  3. Replies
    9
    Views
    317

    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...
  4. Replies
    3
    Views
    236

    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:


    ...
  5. Replies
    2
    Views
    328

    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...
  6. 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...
  7. Replies
    2
    Views
    488

    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...
  8. Replies
    7
    Views
    661

    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)...
  9. Replies
    4
    Views
    442

    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
  10. 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...
  11. Replies
    2
    Views
    357

    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,...
  12. Thread: FIFO Queue

    by aghast
    Replies
    21
    Views
    1,152

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

    Okay, but ...

    First, let's talk about notation:



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

    q->data[0] = data;
  13. Replies
    5
    Views
    494

    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...
  14. Replies
    5
    Views
    494

    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...
  15. Replies
    21
    Views
    1,462

    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...
  16. Replies
    7
    Views
    882

    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,...
  17. Thread: FIFO Queue

    by aghast
    Replies
    21
    Views
    1,152

    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...
  18. Replies
    3
    Views
    516

    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...
  19. Replies
    7
    Views
    882

    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...
  20. What are the valid characters that make up a...

    What are the valid characters that make up a "GENE", exactly? Is it just "ACTG", are "actg" allowed? Are there other characters?
  21. Replies
    5
    Views
    699

    Sorry, but this is false and wrong. First: ...

    Sorry, but this is false and wrong.

    First:
    6.4.5 String literals



    6.4.5(6) In translation phase 7, a byte or code of value zero is appended to each multibyte character sequence that...
  22. Replies
    5
    Views
    531

    Are you comparing the strings in order to sort...

    Are you comparing the strings in order to sort them, or are you comparing the strings just to determine if they are equal or not?

    If you are trying to produce an ordering, then you'll have to...
  23. I would suggest that you evaluate this question...

    I would suggest that you evaluate this question the same way a CPU evaluates this question: do a subtraction, and then look at the resulting number.

    A naive approach would be something like:


    ...
  24. In this code (from lcp): int m = (l +...

    In this code (from lcp):

    int m = (l + r)/2;

    strcpy(str1, lcp(str, l, r));
    strcpy(str2, lcp(str, m+1, r));

    I think the first strcpy line should be "lcp(str,...
  25. Replies
    2
    Views
    413

    I think the first thing to do would be to figure...

    I think the first thing to do would be to figure out how context switching is going to work.

    Write yourself a set of functions that do the absolute minimum scheduling: round-robin.

    - Tasks...
Results 1 to 25 of 38
Page 1 of 2 1 2