Search:

Type: Posts; User: hamster_nz

Page 1 of 6 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    3
    Views
    54

    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,...
  2. Replies
    3
    Views
    122

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

    One of your == is an =.

    Maybe turn on all the compiler warnings?
  3. 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.
  4. 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.
  5. I'm guessing it is because "category" is in...

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

    by hamster_nz
    Replies
    1
    Views
    99

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

    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.
  8. Replies
    9
    Views
    229

    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...
  9. Replies
    9
    Views
    229

    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...
  10. Replies
    17
    Views
    289

    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[],...
  11. Replies
    17
    Views
    289

    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.
  12. Replies
    17
    Views
    289

    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....
  13. You might find this interesting. It uses "ANSI...

    You might find this interesting.

    It uses "ANSI Escape Sequences" to plot things on the console - or at least it does under Linux. I haven't tested it in a Windows Console.



    #include...
  14. 2D or 3D? What do you need your output as? ...

    2D or 3D? What do you need your output as?

    Here's the pseudocode for your program.



    main function()
    read in initial state (positions, masses, velocities) from a file
    ...
  15. With only the include file path is scanned....

    With <> only the include file path is scanned.
    With "" the current directory is first scanned, then the include file path is scanned.

    I would keep the private file in with your source, and the...
  16. Replies
    6
    Views
    232

    (byte)(0xFF - 0x30U) = ? (byte)(0xFF - 0x30U)...

    (byte)(0xFF - 0x30U) = ?

    (byte)(0xFF - 0x30U) = 0xCF.

    If that is a + or - number depends on the definition of 'byte'.
  17. I am not sure what you mean by this. Are you...

    I am not sure what you mean by this. Are you looking at it in an IDE?

    But to answer your question, I would would not have either header file include the other, but include both in the source .c...
  18. Replies
    6
    Views
    232

    You can't have that code. THere are unbalanced...

    You can't have that code. THere are unbalanced brackets in the 'it' statements.

    And " mac1 = 0x10" is missing the semicolon.

    I've made a compellable program:



    #include <stdio.h>...
  19. Replies
    6
    Views
    232

    I haven't looked at your code deeply, what...

    I haven't looked at your code deeply, what platform are you on?

    On Intel, 'char' is a signed type, so 0xFF is -1.

    On ARM 'char' is unsigned, so 0xFF is 255.

    If you have all the compiler...
  20. Replies
    2
    Views
    189

    The important point you are missing is that most...

    The important point you are missing is that most system calls can fail with EINTR



    In the case of sleep():
  21. Replies
    4
    Views
    255

    Yes, I can confirm that is of course true... ...

    Yes, I can confirm that is of course true...



    #include <stdio.h>
    #include <stddef.h>


    struct clientData {
    unsigned int acctNum; // account number 4 bytes no padding
  22. Replies
    4
    Views
    255

    Everything get padded to the nearest 4 bytes,...

    Everything get padded to the nearest 4 bytes, depending on compiler alignment options and active "#pragma" directives. It might be like this:



    struct clientData {
    unsigned int acctNum; //...
  23. Replies
    1
    Views
    206

    Yes, assuming the compiler doesn't optimize...

    Yes, assuming the compiler doesn't optimize everything away.
  24. "od" is a standard Unix/Linux tool to inspect the...

    "od" is a standard Unix/Linux tool to inspect the contents of binary files - it's short for "octal dump"

    The -t is the type parameter in this case one-byte hex values - It defaults to 16-bit octal...
  25. You could write a program to write your data! ...

    You could write a program to write your data!



    #include <stdio.h>


    static unsigned char data[] = {
    0x46, 0x6F, 0x6F, 0x20, 0x62, 0x61, 0x72, 0x21, 0x21, 0x21, 0x20, 0x20, 0x20, 0x20,...
Results 1 to 25 of 129
Page 1 of 6 1 2 3 4