Search:

Type: Posts; User: Salem

Page 1 of 20 1 2 3 4

Search: Search took 0.23 seconds; generated 17 minute(s) ago.

  1. > int face[13]; > int shape[3]; > int...

    > int face[13];
    > int shape[3];
    > int color[1];
    A single card has only a single face value, single shape and single colour.
    Also, shape implies colour - diamonds are always red for...
  2. > I am dealing with a problem in which I have to...

    > I am dealing with a problem in which I have to allocate a huge distance matrix (~600 GB on a cluster node)
    Yeah, uint32 is nowhere near large enough for doing calculations up to 600GB.
  3. Substitute your value of d. #include...

    Substitute your value of d.


    #include <iostream>
    #include <vector>

    int main() {
    size_t d = 1000;
    std::vector<double> buffer( ( (d*(d-1))/2 ), 0 );
    std::cout << "Size=" <<...
  4. Yeah, waitpid() isn't going to work. Unless...

    Yeah, waitpid() isn't going to work.

    Unless the pid is a genuine child process, then the error return is always "No child processes" regardless of whether the process exists or not.

    Plan B -...
  5. > this is a good way the problem is what are the...

    > this is a good way the problem is what are the advantages and disadvantages ?
    In the 4 minutes it took you to reply, did you write and test the code to use waitpid?

    How much more/less code did...
  6. Here's one perhaps. waitpid(2): wait for process...

    Here's one perhaps.
    waitpid(2): wait for process to change state - Linux man page

    There's another, but I'm keeping an air of mystery for a while.
    To see if you can find it (or someone else...
  7. Replies
    28
    Views
    526

    > # elif ('\0'|(1

    > # elif ('\0'|(1 << (CHAR_BIT-1))) < 0

    The whole thing is just going to get promoted all the way up some large type.
  8. Replies
    3
    Views
    339

    It's impossible to verify your formulas based on...

    It's impossible to verify your formulas based on your fuzzy pictures taken from your phone.


    First off, remove useless fluff


    baz.cpp: In function ‘int main()’:
    baz.cpp:16:10: warning:...
  9. Replies
    9
    Views
    282

    You have a lot of direct and indirect recursion...

    You have a lot of direct and indirect recursion of task_switcher().

    Multiple global variables called 'lock', 'count' and 'str' doesn't help with readability.

    Here's my take on your two tasks.
    ...
  10. Replies
    5
    Views
    174

    You seem to have forgotten most of what you...

    You seem to have forgotten most of what you learnt.
    Error: assignment of i_value in read-only object

    Study post #21 in detail.
  11. Replies
    4
    Views
    132

    Your program was screwed from the moment it did...

    Your program was screwed from the moment it did
    strcat(strA,strB);

    There's no point trying to rationalise any right/wrong/weird behaviour beyond that point.
    The code is broken and needs to be...
  12. Replies
    5
    Views
    174

    You're ignoring things. $ gcc -g -Wall foo.c...

    You're ignoring things.


    $ gcc -g -Wall foo.c
    foo.c: In function ‘add_end’:
    foo.c:43:5: warning: ‘return’ with no value, in function returning non-void
    return;
    ^
    foo.c: In function...
  13. > while( iter < maxIter or ea > es ) Perhaps...

    > while( iter < maxIter or ea > es )
    Perhaps you wanted 'and' rather than 'or'

    Remember that 'and(&&)' and 'or(||)' are short-circuit evaluated.
    If the left of || is true, the right isn't even...
  14. Replies
    4
    Views
    132

    > char strA[] = "OPC"; This tells the...

    > char strA[] = "OPC";
    This tells the compiler to count the characters between the "" and make an array of that size.
    So what you really have is strA[4] in this case.

    > char strB[20] =...
  15. Replies
    9
    Views
    282

    Is data_print really an ISR capable of only...

    Is data_print really an ISR capable of only printing one character at a time to some external device?
  16. Replies
    9
    Views
    282

    Well no, you can't assign the contents of what a...

    Well no, you can't assign the contents of what a pointer points to to an array.

    That's why we have functions like strcpy.

    You should find a way of solving your question without so many messy...
  17. Replies
    5
    Views
    381

    > Does anyone know the calculation to do that? ...

    > Does anyone know the calculation to do that?
    Pencil, paper - and a bit of geometry.

    > I can calculate how to center a window on the desktop screen.
    Try doing the same, but introduce a left=0...
  18. Replies
    4
    Views
    180

    > float red2 = image[i][j + 1].rgbtRed; All...

    > float red2 = image[i][j + 1].rgbtRed;
    All these +1 and +2 are going to overflow your array bounds at the limits of your loops.



    float red = 0;
    float green = 0;
    float blue = 0;
    for ( int x...
  19. Replies
    2
    Views
    311

    Scroll down to the "Show threads from the..."...

    Scroll down to the "Show threads from the..." drop-down box.
  20. Replies
    13
    Views
    352

    > return (*(int *)ap > *(int *)bp) - ( *(int *)ap...

    > return (*(int *)ap > *(int *)bp) - ( *(int *)ap < *(int *)bp );
    Unnecessarily terse, and contains a bug.
    Try again.
  21. Replies
    13
    Views
    352

    > printf("%d", list[j]); Move it into the i...

    > printf("%d", list[j]);
    Move it into the i loop, and print subscript i instead.

    Also, you don't need an array of temp, just one.
  22. Replies
    13
    Views
    352

    You're not swapping anything at line 17. Swaps...

    You're not swapping anything at line 17.

    Swaps typically take 3 lines of code.
  23. Replies
    3
    Views
    176

    Have you tried pressing 9 and then enter?

    Have you tried pressing 9 and then enter?
  24. Replies
    6
    Views
    385

    So instead of learning how to solve a problem,...

    So instead of learning how to solve a problem, the OP has learnt that eventually, some schmuck will do their work for them.
  25. Replies
    12
    Views
    390

    > width = bmih.biWidth; if (width%4 != 0) width...

    > width = bmih.biWidth; if (width%4 != 0) width += (4-width%4);
    This is wrong.

    If you have a width of 9 pixels, and 3 bytes per pixel, you have 27 bytes of pixel data per row.

    It is the...
Results 1 to 25 of 499
Page 1 of 20 1 2 3 4