Search:

Type: Posts; User: Salem

Page 1 of 20 1 2 3 4

Search: Search took 0.28 seconds; generated 45 minute(s) ago.

  1. Replies
    1
    Views
    120

    For something that simple, just use an inline...

    For something that simple, just use an inline function.


    static inline void exit_the_prog() {
    printf("Error: There was an error with the program");
    exit(2);
    }


    Templates are for...
  2. Replies
    1
    Views
    91

    Well posting what your 'Reversi_t' type looks...

    Well posting what your 'Reversi_t' type looks like would be a big help.
  3. Thread: Task creations

    by Salem
    Replies
    7
    Views
    196

    Sure, why not - let's see how far you can run...

    Sure, why not - let's see how far you can run with this.

    Your very basic task control block needs a few things
    - a task state, see FreeRTOS task states and state transitions described for ideas....
  4. Thread: Task creations

    by Salem
    Replies
    7
    Views
    196

    It's all in the previous threads.

    It's all in the previous threads.
  5. Thread: Task creations

    by Salem
    Replies
    7
    Views
    196

    You mean you got nothing from your previous...

    You mean you got nothing from your previous threads?
    How do you design scheduler ?
    Top design- real time operating system
    How to write code for round robin scheduling
    Free rtos code example 1...
  6. Replies
    5
    Views
    157

    codeblocks-20.03mingw-setup.exe is an all-in-one...

    codeblocks-20.03mingw-setup.exe is an all-in-one package.
    You just install it, and you get the compiler, debugger, editor all wrapped up for you.

    There is nothing else needed to start writing...
  7. Replies
    5
    Views
    157

    Eclipse is just an IDE. It doesn't come with a...

    Eclipse is just an IDE.
    It doesn't come with a compiler, hence the "g++ not found in PATH" messages.

    If you want an all-in-one complete package, try code::blocks.
    Binary releases - Code::Blocks...
  8. A couple of basic things first before trying more...

    A couple of basic things first before trying more advanced things.

    > fgets(hraci[id_hraca].meno,50,stdin);
    Don't lie about your buffer sizes.

    Use sizeof on the array you're reading into, like...
  9. Replies
    2
    Views
    122

    You could make a union out of it. typedef...

    You could make a union out of it.


    typedef struct
    {
    uint8_t type;
    uint8_t num;
    uint8_t id;
    union {
    int value;
  10. Replies
    2
    Views
    150

    I suppose the first question would be,...

    I suppose the first question would be, whereabouts in the world are you geographically located (country/state or equivalent).

    Second question, how far are are you willing to relocate?

    > I'm a...
  11. Replies
    5
    Views
    156

    Your concatenate is fine, so long as your array...

    Your concatenate is fine, so long as your array has a NULL sentinel value at the end.

    No sentinel, then you need to provide a count of how many elements there are.
  12. Replies
    5
    Views
    156

    As far as the compiler is concerned, a string...

    As far as the compiler is concerned, a string constant is represented as an anonymous char array.

    So your first post is


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

    const...
  13. Replies
    5
    Views
    156

    It's not comparing strings, it's comparing...

    It's not comparing strings, it's comparing pointers.

    And it relies on the compiler combining identical strings, so that the pointer to "" in the array is the same pointer to "" in the while...
  14. Replies
    4
    Views
    190

    > char **result = malloc(sizeof(char)); This...

    > char **result = malloc(sizeof(char));
    This doesn't allocate anywhere near enough space.
    At the very least, you need to start with


    char **result = malloc(sizeof(char*));


    Additionally,...
  15. Replies
    4
    Views
    177

    p no longer points to the start of your array. ...

    p no longer points to the start of your array.

    So you print the tail end of the array, then whatever 'garbage' there is in memory.
  16. Replies
    3
    Views
    187

    Did you look up what strcmp returns, or did you...

    Did you look up what strcmp returns, or did you just guess that it returns "true" when the strings are equal?
  17. Thread: Username change

    by Salem
    Replies
    1
    Views
    237

    Send a PM to...

    Send a PM to https://cboard.cprogramming.com/member.php?u=1
  18. Thread: smallest coin

    by Salem
    Replies
    2
    Views
    223

    Also here -> coin smallest - C++ Forum...

    Also here -> coin smallest - C++ Forum
  19. Replies
    4
    Views
    261

    > if(fscanf(fd, "%s:%[^:]:%s:%d:%d:%d:%d:%d",...

    > if(fscanf(fd, "%s:%[^:]:%s:%d:%d:%d:%d:%d", flag, nom, s, &st1, &st2, &st3, &po, &ti) != 8)
    Maybe try == 8 instead.

    In fact, this is better.


    char buff[BUFSIZ];
    while (...
  20. Replies
    17
    Views
    491

    > But I fail to see why pointer arithmetic and...

    > But I fail to see why pointer arithmetic and indirection, plus pos-increment are "obfuscation".
    For the OP, I'm pretty damn sure that what you posted would count as obfuscated.

    As for all the...
  21. Replies
    17
    Views
    491

    Any decent compiler will do that optimisation for...

    Any decent compiler will do that optimisation for you, without making the code obscure in the process.
  22. Replies
    17
    Views
    491

    > a[b] = a[b]+2; Compare with a[b] =...

    > a[b] = a[b]+2;

    Compare with
    a[b] = a[b-1]+2;

    And you want to do <10 for both loops.
  23. Something wrong with your setup if you're not...

    Something wrong with your setup if you're not getting any errors.


    $ gcc -Wall -ansi -pedantic foo.c
    foo.c: In function ‘cmd_line’:
    foo.c:31:21: warning: statement with no effect...
  24. Replies
    17
    Views
    491

    > printf ("%d\n", a[i]); Yah think this should...

    > printf ("%d\n", a[i]);
    Yah think this should be a different subscript as well?

    > for (b=0;b<9;b++)
    a[0] is already set, so perhaps this loop should start at 1.

    Also, think about what "this...
  25. Replies
    17
    Views
    491

    > a[i] = a[i]+2; Perhaps you should use [b] as...

    > a[i] = a[i]+2;
    Perhaps you should use [b] as your array subscript.
Results 1 to 25 of 491
Page 1 of 20 1 2 3 4