Search:

Type: Posts; User: Salem

Page 1 of 20 1 2 3 4

Search: Search took 0.29 seconds.

  1. Thread: FIFO Queue

    by Salem
    Replies
    11
    Views
    212

    Enqueue is q->data[q->front++] = data; ...

    Enqueue is
    q->data[q->front++] = data;

    Dequeue is
    return q->data[q->back++];

    Well that's the essential part, you need to
    - check the queue isn't full when adding
    - check the queue isn't...
  2. Thread: FIFO Queue

    by Salem
    Replies
    11
    Views
    212

    This should be struct Queue q; ...

    This should be


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

    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()
  4. Thread: FIFO Queue

    by Salem
    Replies
    11
    Views
    212

    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;
    };
    ...
  5. Replies
    1
    Views
    101

    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 );

    ...
  6. > 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...
  7. 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)...
  8. Replies
    20
    Views
    541

    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>
  9. > 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...
  10. > 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
  11. Replies
    20
    Views
    541

    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)."
  12. > 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.
  13. Replies
    5
    Views
    168

    > 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 -...
  14. 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...
  15. Thread: if...else ERROR

    by Salem
    Replies
    2
    Views
    175

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

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

    strcpy(city.lat_dir,"INVALID");
  16. Replies
    20
    Views
    541

    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...
  17. Replies
    20
    Views
    541

    > 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...
  18. Thread: mfc c++

    by Salem
    Replies
    3
    Views
    154

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

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

    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...
  20. Thread: Pointers stuff

    by Salem
    Replies
    4
    Views
    225

    Yes, moved.

    Yes, moved.
  21. Thread: Pointers stuff

    by Salem
    Replies
    4
    Views
    225

    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...
  22. So what's == if it's not a comparison operator?

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

    by Salem
    Replies
    3
    Views
    154

    > 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.
  24. Replies
    2
    Views
    138

    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...
  25. 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...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4