Search:

Type: Posts; User: mzn

Search: Search took 0.00 seconds.

  1. Replies
    2
    Views
    795

    I have different quantities of each material for...

    I have different quantities of each material for each 32 items, yes. You're right though, I'll just stick to that array although it's going to be big and ugly (and I'm going to need more of such...
  2. Replies
    2
    Views
    795

    Something else over an array.

    Consider there is 32 indexed items and each of those items would be made of 16 indexed materials. I need to intialize each item with the materials it is made of. Now, I could make a 2-dimensional...
  3. Thread: Counting ints

    by mzn
    Replies
    12
    Views
    1,513

    No need for arrays or auxiliary functions nor...

    No need for arrays or auxiliary functions nor that MAX constant. Think about it, all you need to do is increment a variable once in while-iteration, and the loop starts like this:


    ...
  4. Thread: Counting ints

    by mzn
    Replies
    12
    Views
    1,513

    If this is what your program is supposed to do,...

    If this is what your program is supposed to do, ie.

    input: 2 4 6 8
    output: 4

    then start over from scratch and use things I mentioned earlier, thats all you need.
  5. Thread: Counting ints

    by mzn
    Replies
    12
    Views
    1,513

    Recipe you're looking for is something as...

    Recipe you're looking for is something as follows:

    2 x int
    1 x while
    1 x scanf
    1 x test against EOF
    1 x increment operator
    1 x printf

    Ctrl-D to send EOF when running the program. Have fun...
  6. Replies
    18
    Views
    2,357

    I don't think he gets away any easier using...

    I don't think he gets away any easier using strchr. But what I do think is that strlen return value just might be more of use later in his code, thats only my guess though ;)
  7. Replies
    18
    Views
    2,357

    fgets stops when it sees newline and stores it,...

    fgets stops when it sees newline and stores it, so I think you need simply something like this:


    size_t len;
    while(fgets(buffer, sizeof buffer, f)){
    len = strlen(buffer);
    ...
Results 1 to 7 of 7