Search:

Type: Posts; User: Sir Galahad

Page 1 of 8 1 2 3 4

Search: Search took 0.01 seconds.

  1. You should be incrementing the counter inside of...

    You should be incrementing the counter inside of push_int() rather than outside of the function.

    And the resize calculation should probably be something more like this:



    int* push_int (int...
  2. Replies
    5
    Views
    158

    To be safe, you should limit the maximum number...

    To be safe, you should limit the maximum number of characters in the scanf call, ie:



    scanf("%30s", name);



    It's one less than the size of the actual buffer to ensure room for the null...
  3. I'm running Firefox on Ubuntu. No add-ons, except...

    I'm running Firefox on Ubuntu. No add-ons, except for HTTPS Everywhere (which doesn't mess with graphics).
  4. MODERATORS: Better code formatting please?

    Code posted to the forum seems to overlap:

    16206
  5. Replies
    3
    Views
    176

    You could also simplify things quite a bit. Most...

    You could also simplify things quite a bit. Most of the arguments to your functions are actually just constants, so they could really be consolidated inside those functions:



    #include <stdio.h>...
  6. Replies
    3
    Views
    176

    Your return statement is malformed. The main()...

    Your return statement is malformed. The main() function should return 0 on success or nonzero (usually 1) on error.

    Also pay attention to warnings. The expression



    sizeof(abw_to_abv) /...
  7. Looking at other libraries now, filling does...

    Looking at other libraries now, filling does indeed seem to be a more typical interface. So maybe you're right. I'll give it another go...
  8. Replies
    27
    Views
    649

    Where is the damn "like" button?! Anyway, nice...

    Where is the damn "like" button?!

    Anyway, nice breakdown mate.
  9. Having thought about it for a while now, I've...

    Having thought about it for a while now, I've finally decided to simply stick with the old behaviour. It's just more consistent, mathematically. I did of course add a fill() member function for...
  10. Replies
    3
    Views
    148

    You could use getline...

    You could use getline() to read each line, split it by spaces, and then a stringstream object to extract valid values.

    The real question though is why are you even trying to make sense of bad...
  11. Replies
    16
    Views
    417

    Or maybe just stick to strtol, strtoul, and...

    Or maybe just stick to strtol, strtoul, and strtod. They'll do a much better job at detecting valid numeric sequences, not to mention taking care of copying the value into an actual variable.
  12. I guess to be semantically correct it really...

    I guess to be semantically correct it really should be "assigning a variable a value" or "assigning a value to a variable". So yes, you are correct, assign a scalar to a matrix.




    Right, the...
  13. Matrix behaviour: assignment to scalar

    I'm working on a little matrix library. But now I'm faced with a tricky interface question.

    Assigning a matrix to a scalar, does it make more sense to

    (A) set every element of the matrix to...
  14. Replies
    16
    Views
    417

    Maybe, but the other way is probably less error...

    Maybe, but the other way is probably less error prone.


    printf("The number you entered is %d and the character is %s\n", string1, number1);

    Whoops.


    printf("%s%d%s%s\n", "The number you...
  15. Replies
    3
    Views
    555

    Sounds like a software issue. Can you verify that...

    Sounds like a software issue. Can you verify that absolutely no other programs are running at boot-up?
  16. Post the code you're having trouble with. And...

    Post the code you're having trouble with. And maybe try this forum as well.
  17. I'd imagine puts() would be pretty efficient.

    I'd imagine puts() would be pretty efficient.
  18. I'm sensing an extreme level of irony here. :p

    I'm sensing an extreme level of irony here. :p
  19. Thanks. And kudos to you for a better job of code...

    Thanks. And kudos to you for a better job of code documentation. I do try to make mine as self-documenting as possible, but in the process oft times forget to do much commenting...
  20. Replies
    7
    Views
    474

    Yep, long time Windows here. Having switched to...

    Yep, long time Windows here. Having switched to Linux a number of years ago, I wouldn't think of going back.
  21. Reverse in-place using swaps: #include...

    Reverse in-place using swaps:



    #include <string.h>

    char* reverse(char* text)
    {
    char* left = text;
    char* right = text + strlen(text);
  22. Well I can't argue with that. =] But...

    Well I can't argue with that. =]

    But seriously, thank you.
  23. Well perhaps you could be a little more...

    Well perhaps you could be a little more considerate in your responses then?
  24. When someone says things like "your work has done...

    When someone says things like "your work has done nothing whatsoever to help the Linux or any other community", it's just unnecessary. We can do better than that.
  25. ...said the troll.

    ...said the troll.
Results 1 to 25 of 180
Page 1 of 8 1 2 3 4