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...
Type: Posts; User: DMH
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...
The file with the error is main.c.
#include <stdio.h>
#include <string.h>
#include "parser.h"
parser.h...
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:
...
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...
Call rand() outside of nine() and pass that to nine(). Then use that argument for your calculations.
Is that universal enough that I can count on it?
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,...
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...
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...
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;...
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...
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...