Search:

Type: Posts; User: john.c

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    110

    Do you know about two-dimensional arrays?...

    Do you know about two-dimensional arrays?
    Suppose exactly this is in a file called table1.txt:


    61 62 63 64 65 66 67 68 69 70
    126 125.6 125.2 124.9 124.6...
  2. Thread: Filling arrays

    by john.c
    Replies
    5
    Views
    292

    You're on your own, moron.

    You're on your own, moron.
  3. Thread: Filling arrays

    by john.c
    Replies
    5
    Views
    292

    If you're using a freak language then you're on...

    If you're using a freak language then you're on your own.
    Choose C or C++.
    Here's a simple C program that does something like you want.
    (If you're trying to make a mini-shell, this is not how to...
  4. You're not thinking. The last two lines are...

    You're not thinking.
    The last two lines are simply printed like this:


    printf(" +-----|-----|-----|-----|------>\n");
    printf(" A E I O U\n");
  5. Replies
    1
    Views
    161

    #include char *pull_word(char *cmd,...

    #include <stdio.h>

    char *pull_word(char *cmd, char delim) {
    puts(cmd);
    char *p = cmd;
    for ( ; *p != '\0' && *p != delim; p++)
    ;
    while (*p == delim) ++p;
    return...
  6. I have no idea what pg/pglib.h is, but if it...

    I have no idea what pg/pglib.h is, but if it creates an image file or some kind of graphical output in a separate window then that is not what this program is asking for. Instead you are meant to...
  7. Replies
    2
    Views
    191

    Your question makes no sense to me. What is...

    Your question makes no sense to me.
    What is "k-drome"?
    What do you mean "characters to remove"?
    In what way does it not "work as expected"?
  8. Replies
    17
    Views
    492

    It's not obfuscating but fill2 is harder for a...

    It's not obfuscating but fill2 is harder for a beginner to understand. :-)

    That ball program is pretty good. This flight simulator is pretty cool. The code and scenary files can be found here:...
  9. Replies
    17
    Views
    492

    I doubt salem meant to compare those two...

    I doubt salem meant to compare those two functions. They will obviously generate very different code. Presumably he meant something more like this:


    #include <stdio.h>

    void fill(int *a,...
  10. No, you don't need the "s". Get rid of it. Also,...

    No, you don't need the "s". Get rid of it.
    Also, compile with
    gcc -std=c99 -Wall -Wextra -Wpedantic -Werror ...
  11. There is a problem with the scanf format string....

    There is a problem with the scanf format string. You've put an extraneous "s" after the format. And the size should be one less than the char array size. So it should be:


    scanf("...
  12. Post code as plain text (you've posted a bunch of...

    Post code as plain text (you've posted a bunch of markup along with it).
    Post the whole program so we can run it.
    Always compile your program with a high warning level (e.g., gcc -Wall -Wextra...
  13. Replies
    2
    Views
    230

    Well, obviously you can't just add the values...

    Well, obviously you can't just add the values together since you could end up with a result that is higher than the maximum allowed value.
  14. Replies
    2
    Views
    182

    Yep. -> is level 1 whereas & is level 2....

    Yep. -> is level 1 whereas & is level 2. Precedence determines grouping (where the "invisible parentheses" are). So the operands of -> are grouped with it first, as you show in the second code...
  15. Replies
    1
    Views
    197

    "Help with C question" is a useless title....

    "Help with C question" is a useless title. Obviously you want help with a C question since you posted a question in a C forum. A better title would be "Writing my own atoi function".


    #define...
  16. A single missing letter like that can be insanely...

    A single missing letter like that can be insanely hard to spot. Remember to use the maximum warning level (for gcc use -Wall -Wextra -Wpedantic). Maxing out the warning level can point out some...
  17. Your include guard is wrong. Instead of #ifdef it...

    Your include guard is wrong. Instead of #ifdef it should be #ifndef
  18. Replies
    6
    Views
    269

    Search for //// to find all my comments. ...

    Search for //// to find all my comments.


    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    #define maxheight 1080
    #define maxwidth 1920
    #define RGB_COMPONENT_COLOUR 255
  19. @flp, It should be: int intdigits(double x)...

    @flp, It should be:


    int intdigits(double x)
    {
    x = log10(fabs(x));
    return x < 0 ? 1 : floor(x) + 1;
    }

    Testing:
  20. It looks like it might work. #include...

    It looks like it might work.


    #include <iostream>

    uint32_t a[2]
    {
    0x11223344, // 00010001 00100010 00110011 01000100
    // ^^^^^ FieldA = 8...
  21. @laserlight, Do you know why it's saying "error:...

    @laserlight, Do you know why it's saying "error: wrong number of template arguments (1, should be 2)"?

    @cyberfish, Not exactly sure what you're trying to do, but here's another possibility:

    ...
  22. If you actually made the changes you said you...

    If you actually made the changes you said you made then you wouldn't get the error you say you're getting.
    At any rate, you should open the file in text mode, not binary mode.
    And you need to...
  23. Replies
    2
    Views
    397

    You're refering to this page...

    You're refering to this page, which is not the one you link. Note that it says the facet is used for comparison as well as hashing. regex is presumably using the locale-aware comparisons.


    Why...
  24. You are saying that if you start the program it...

    You are saying that if you start the program it will run for 15 minutes and then "stop". I'm not familiar with the rasberry pi. Is it possible the program is segfaulting? Can you tell? If it is...
  25. It's kind of a silly question. Do what you want....

    It's kind of a silly question. Do what you want. The %o and %x formats for printf are defined to work only with unsigned integers so they interpret the representation of the signed value as an...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4