Search:

Type: Posts; User: Salem

Page 1 of 20 1 2 3 4

Search: Search took 0.30 seconds; generated 11 minute(s) ago.

  1. Thread: FIFO Queue

    by Salem
    Replies
    8
    Views
    154

    This should be struct Queue q; ...

    This should be


    struct Queue q;
    queueInit(&q);
  2. Replies
    3
    Views
    113

    Like this perhaps. #include ...

    Like this perhaps.


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

    char *changeString(char *str, size_t size);

    int main()
  3. Thread: FIFO Queue

    by Salem
    Replies
    8
    Views
    154

    I would suggest you start with a simple finite...

    I would suggest you start with a simple finite array version you can prototype with to make sure everything works as you expect.


    struct Queue {
    int data[10];
    int front;
    int back;
    };
    ...
  4. Replies
    1
    Views
    82

    List traversal. struct Node* temp = Head;...

    List traversal.


    struct Node* temp = Head;
    while ( temp ) {
    // do something with the current node
    printf("This=%p Next=%p Data=%d\n",
    (void*)temp, (void*)temp->Next, temp->X );

    ...
  5. > I don't know what it does but I commented it...

    > I don't know what it does but I commented it and the code works the same way, what it does exactly ?
    Read the M$ manual page for it.

    > Why the first while loop doesn't break or stop, I put a...
  6. Figures - I was wondering how someone could write...

    Figures - I was wondering how someone could write multiple threaded code and not have a clue how to fix a simple printf.
    Calculate Pi with Leibniz formula using pthread library (as part of C course)...
  7. Replies
    19
    Views
    489

    Well that was interesting. #include...

    Well that was interesting.


    #include <stdio.h>
    #include <stdlib.h>
    #include <limits.h>
    #include <math.h>
    #include <unistd.h>
    #include <pthread.h>
  8. > strtok isn't helpful in this kind of situation...

    > strtok isn't helpful in this kind of situation that is why I worked on this piece of code.
    How so?

    You can pass multiple tokens to strtok.


    #include <stdio.h>
    #include <string.h>
    int main...
  9. > printf("\nThe value of Pi = %f\n", threads,...

    > printf("\nThe value of Pi = %f\n", threads, pi);
    You have two parameters, but only one % conversion in the format string.

    Maybe


    printf("\nThe value of Pi = %f\n", pi);
    or
  10. Replies
    19
    Views
    489

    Not without seeing your current code. Sieve of...

    Not without seeing your current code.

    Sieve of Eratosthenes - Wikipedia
    "Sieve of Eratosthenes: algorithm steps for primes below 121 (including optimization of starting from prime's square)."
  11. > I don't know what it's actually, a struct or a...

    > I don't know what it's actually, a struct or a function,
    It's quite obviously a function.
  12. Replies
    3
    Views
    114

    > I'm not sure how critical this part may be. ...

    > I'm not sure how critical this part may be.
    Very - Setting up the initial hardware environment is a delicate operation, especially when that hardware can also generate interrupts.
    Not at all -...
  13. One or more of these. Using Timer Queues - Win32...

    One or more of these.
    Using Timer Queues - Win32 apps | Microsoft Docs
    Using Timers - Win32 apps | Microsoft Docs
    About Timers - Win32 apps | Microsoft Docs
    SetTimer function (winuser.h) - Win32...
  14. Thread: if...else ERROR

    by Salem
    Replies
    2
    Views
    153

    > city.lat_dir = 'INVALID!'; Use strcpy to copy...

    > city.lat_dir = 'INVALID!';
    Use strcpy to copy strings to arrays.

    strcpy(city.lat_dir,"INVALID");
  15. Replies
    19
    Views
    489

    You only need 1 bit per random number (you're...

    You only need 1 bit per random number (you're only storing a true/false).
    So the whole RAND_MAX range would only need 256MB of memory.
    But the lookup is O(1) when you're done.

    By contrast, an...
  16. Replies
    19
    Views
    489

    > 100M numbers is only 5% of the range of a...

    > 100M numbers is only 5% of the range of a 32-bit RAND_MAX.
    RAND_MAX is say 2147483647, which is 20x bigger than 100M, hence 5%

    > If I make a pre-computed sieve table, isn't that cheating?
    Only...
  17. Thread: mfc c++

    by Salem
    Replies
    3
    Views
    140

    Your picture doesn't work, and you obviously mean...

    Your picture doesn't work, and you obviously mean something else than "recover".
  18. Replies
    5
    Views
    165

    So how does this differ from std::vector or...

    So how does this differ from std::vector or std::array ?

    I see your readme has "If you wanna use type std::string it won't work , so instead use char*"
    Does that go for anything else which isn't...
  19. Thread: Pointers stuff

    by Salem
    Replies
    4
    Views
    201

    Yes, moved.

    Yes, moved.
  20. Thread: Pointers stuff

    by Salem
    Replies
    4
    Views
    201

    There are two (or 3) things wrong with your rev...

    There are two (or 3) things wrong with your rev function.
    1. Your local reverse array is too short (there is no room for a \0)
    2. Your local array goes out of scope when you return. You don't...
  21. So what's == if it's not a comparison operator?

    So what's == if it's not a comparison operator?
  22. Thread: mfc c++

    by Salem
    Replies
    3
    Views
    140

    > I have an exe file with Dlg.cpp and h files >...

    > I have an exe file with Dlg.cpp and h files
    > How can i recover visual studio
    If you're hoping to get back your original source code, that isn't going to happen.
  23. Replies
    2
    Views
    124

    No idea what you were searching for, but there's...

    No idea what you were searching for, but there's plenty to be found.

    An introduction to schedulers:Co-operative and pre-emptive scheduling ~ 8051 microcontrollers
    7 steps to writing a simple...
  24. Runaway recursion perhaps? #0 ...

    Runaway recursion perhaps?


    #0 0x000000000040077a in lcp (str=<error reading variable: Cannot access memory at address 0x7fffff7fef38>,
    l=<error reading variable: Cannot access memory at...
  25. That's not how getline works. getline(3):...

    That's not how getline works.
    getline(3): delimited string input - Linux man page

    You just keep calling it in a loop, and if there is a longer line somewhere in the input, getline will realloc as...
Results 1 to 25 of 495
Page 1 of 20 1 2 3 4