Search:

Type: Posts; User: hamster_nz

Page 1 of 6 1 2 3 4

Search: Search took 0.01 seconds.

  1. Probably not worth persevering. They are given...

    Probably not worth persevering.

    They are given three things to download. All three go together to make the complete program.

    They only download one of the three parts, try to build it and it...
  2. The actual ordering doesn't matter, just as long...

    The actual ordering doesn't matter, just as long as they are consistent. That is wath optimizing compilers do.

    For sample, as age and myList[] are not used, they won't even end up on the stack -...
  3. Replies
    2
    Views
    72

    void reall(int*** matrix1, const int lin1, const...

    void reall(int*** matrix1, const int lin1, const int col1, int** matrix2,
    const int lin2, const int col2)
    {
    int** temp1 = (int**)realloc(*matrix1, lin2 * sizeof(int*));
    for (int i = 0;i...
  4. Replies
    2
    Views
    72

    Your problem is that you are realloc()ing the...

    Your problem is that you are realloc()ing the existing rows, then initializeing the whole row to zero.

    You only need to initialize any new items added to the row.

    You also do not need to do the...
  5. Just also download the other two files, and put...

    Just also download the other two files, and put them in the same directory as the rest.
  6. Here's the contents of the README: To...

    Here's the contents of the README:


    To compile the Spiral-generated decoder, simply put the generated code
    and header files in the same directory than the infrastructure files and
    type "make"....
  7. Works on my machine. As well as the...

    Works on my machine.

    As well as the infrastructure bundle you also need the '.c' and '.h' file, labeled as spiral-vit<something>.c & spiral-vit<something>.c

    I also had to add -lm to the...
  8. Replies
    6
    Views
    275

    Do you need something like this? ...

    Do you need something like this?



    printf("Enter your birth year\n");
    scanf("%d", &year);
    while(year<=1920 || year>=2020) {
    printf("Invalid Year of Birth \n");
    printf("Re-enter your...
  9. Oh, you also need to have a non-blocking open on...

    Oh, you also need to have a non-blocking open on the pipe:



    int fd = open("mySemaphorPipe", O_RDWR|O_NONBLOCK);


    From "man 7 fifo"
  10. Hey! Found it.... For sem_open, you need...

    Hey! Found it....

    For sem_open, you need O_CREAT, not IPC_CREAT.

    Also, your name (SEM_WRITE) MUST begin with a leading slash.

    And the semaphore needs an initial value of 1.

    And you should...
  11. Replies
    6
    Views
    275

    Can you show us your sample output when the...

    Can you show us your sample output when the problem occurs?

    I suspect you want to 'loop' around when getting the date, while the day, month or year is invalid.

    Also this might be an easier way...
  12. How many processes do you want? Because you 7...

    How many processes do you want? Because you 7 running, I think.
  13. Interesting. Are you running it on ARM? ...

    Interesting. Are you running it on ARM?

    Because on Intel you have a security issue as characters are signed, so:



    hasChar[ string[i] ] = 1


    ...will trash the stack. This could...
  14. Replies
    6
    Views
    289

    Three options I can see straight off: 1....

    Three options I can see straight off:

    1. Memory is cheap. Why not just set an upper teams of 1000 teams, and 100 character long names. Thats < 0.1 megabyte.

    2. Put them into a linked list,...
  15. Replies
    3
    Views
    191

    One of your == is an =. Maybe turn on all the...

    One of your == is an =.

    Maybe turn on all the compiler warnings?
  16. You are playing with fire here... it will burn...

    You are playing with fire here... it will burn you!

    Here... have a match and some lighter fluid:



    ProductType *p;
    p = (ProductType *)product.
  17. Also b->grid[i][j] =...

    Also



    b->grid[i][j] = toupper(b->grid[i][j]);


    Is most likely a little bit suspect. You will be updating the contents of the grid and that might have a wider impact in a larger program.
  18. I'm guessing it is because "category" is in...

    I'm guessing it is because "category" is in 'EntityType', and not in 'ProductType'.
  19. Thread: Recursion

    by hamster_nz
    Replies
    1
    Views
    148

    You might notice that even and odd are much the...

    You might notice that even and odd are much the same function...

    odd(n);

    will be the same value as:

    even(n/10);

    Also, something about the "if(n < 10)" feels wrong. I feel you should be...
  20. Replies
    17
    Views
    379

    Using size_t is the right thing to do, but feel...

    Using size_t is the right thing to do, but feel free to use plain old int.

    'size_t' is just an appropriately sized unsigned integer that matches the processor's address space.
  21. Replies
    9
    Views
    286

    Can you reword that so you are clear about...

    Can you reword that so you are clear about 'bytes', characters, C 'chars' and unicode characters?

    They are all slightly different things.

    Using mixed somewhat vague words is obscuring the...
  22. Replies
    9
    Views
    286

    Wikipedia has a graphic with all the info you...

    Wikipedia has a graphic with all the info you need at UTF-8 - Wikipedia - UFT-8 can be up to 8 bytes in length, but they don't have to be.

    Also, think about using getc() rather than read(). It...
  23. Replies
    17
    Views
    379

    I would approach it this way. // Returns...

    I would approach it this way.



    // Returns 0 if all the same or empty.
    // 1 if increasing
    // 2 if decreasing
    // 3 if unsorted
    int order(unsigned array[],...
  24. Replies
    17
    Views
    379

    If rmmstn is still reading the thread, you have a...

    If rmmstn is still reading the thread, you have a problem here:



    for(int i = 0; i < n; ++i){


    For n items, you need to make n-1 comparisons.
  25. Replies
    17
    Views
    379

    Safe to assume it is the build-up to writing a...

    Safe to assume it is the build-up to writing a sort function.

    Write the test first....
Results 1 to 25 of 142
Page 1 of 6 1 2 3 4