Search:

Type: Posts; User: DMH

Search: Search took 0.00 seconds.

  1. Replies
    18
    Views
    2,279

    stdio.h is a C header file. Change it to ...

    stdio.h is a C header file. Change it to


    #include <iostream>

    Also, main should return an int.

    Beyond that, you define int x twice, one local to main, and one local to the for loop; only...
  2. Replies
    2
    Views
    4,181

    The file with the error is main.c. #include...

    The file with the error is main.c.


    #include <stdio.h>
    #include <string.h>
    #include "parser.h"

    parser.h...
  3. Replies
    2
    Views
    4,181

    fatal error LNK1104

    Hello. I have a solution with three projects in it. Most of the files are .c's, but a few are .cpp's, so I figured this should go here. Anyway, when I try to build the solution I get this error:
    ...
  4. Thread: realloc() problems

    by DMH
    Replies
    19
    Views
    2,233

    Okay, I've done a bit of research, and there's a...

    Okay, I've done a bit of research, and there's a function called atexit() defined in stdlib.h.

    Looking at K&R, it says its prototype is

    int atexit(void (*fcn)(void))
    Is there a good way I...
  5. Replies
    7
    Views
    3,968

    Call rand() outside of nine() and pass that to...

    Call rand() outside of nine() and pass that to nine(). Then use that argument for your calculations.
  6. Thread: realloc() problems

    by DMH
    Replies
    19
    Views
    2,233

    Is that universal enough that I can count on it?

    Is that universal enough that I can count on it?
  7. Thread: realloc() problems

    by DMH
    Replies
    19
    Views
    2,233

    Those Max values are exactly what I'm trying to...

    Those Max values are exactly what I'm trying to avoid. See, if I just wanted to take the easy way out, I'd just have pointer arrays with, say, 100 characters each to hold the verbs. That's easy,...
  8. Thread: realloc() problems

    by DMH
    Replies
    19
    Views
    2,233

    Yes, but...we're going to have somewhere in the...

    Yes, but...we're going to have somewhere in the neighborhood of 200 rooms. I don't want us to have to call a "myRoomFree()" function 200 times before the end of the program. It's annoying and...
  9. Thread: realloc() problems

    by DMH
    Replies
    19
    Views
    2,233

    Thanks so much! But now I am lost ONCE AGAIN! ...

    Thanks so much!

    But now I am lost ONCE AGAIN! (Woot.)

    I know I have to free() these allocations once I'm done with them. If I'm going to have an indefinite number of structures, each with its...
  10. Thread: realloc() problems

    by DMH
    Replies
    19
    Views
    2,233

    Yes! I got it to work. Thanks, both of you. ...

    Yes! I got it to work. Thanks, both of you.

    Here's my current code:


    void initializeVerbs(Room *room, unsigned int nArgs, const char *arg, ...)
    {
    unsigned short size = 0;
    char *temp;...
  11. Thread: realloc() problems

    by DMH
    Replies
    19
    Views
    2,233

    Still having troubles. I changed char...

    Still having troubles. I changed


    char *verbs;to

    char **verbs;and made these changes...

    void initializeVerbs(Room *room, unsigned int nArgs, const char *arg, ...)
    {
    unsigned short size...
  12. Thread: realloc() problems

    by DMH
    Replies
    19
    Views
    2,233

    realloc() problems

    Okay, I'm trying to learn how to dynamically allocate memory, and I figure the best way to do it is to try to make something with it and learn as I go.



    //main.c

    #include <stdio.h>
    #include...
Results 1 to 12 of 12