Thanks! Got sscanf to work
Type: Posts; User: voidpain()
Thanks! Got sscanf to work
Part of my file:
int main(void)
{
int done = 0;
char line[300];
You were right, that's what was wrong. I am going to have to gut a lot of my code because I am making these same mistakes in multiple places. =/
At the end of your code, what is the getchar();? ...
void areaItems (int area, Item *sPtr); //I declare it
//...later on
areaItems(current, startPtr); //I call it
void areaItems(int area, Item *sPtr)
{
printf("%s\n", sPtr->name);
}
Thank you Andrew and quzah (posts 8 and 9), trying now
TheBigH, see post #4. I'm not trying to ........ anyone off, haha, I really did get this out of my textbook, and I already said I wasn't going to do this again, not to mention apologizing for it...
Yes, someone else mentioned this earlier. I actually got this straight out of my textbook. I'd be happy not to do it again, but I've been on the same assignment since I've joined the forum. I'm...
Also, my sincere apologies for all the questions as of late (and for those of you who've had to repeat yourself throughout my mistakes). This forum has been the best help I've gotten thus far
I am trying to access information within a structure. I am trying to do this by passing a pointer to the structure into a function. The function is declared like so:
void areaItems(Ptr...
Awesome, fscanf() worked nicely, thanks!
Thanks Andrew, I'm trying the things in your code in a different file right now
@Andrew, the typedef pointer is actually coming straight from my textbook (C: How to Program by Deitel). While that does not make this decision any better, I am trying to follow the examples as...
I am reading in a file and storing its information into this structure:
typedef struct Item
{
char *name;
int area;
struct Item *nextPtr;
} Item;
Works perfectly. Exactly what I was looking for. Thanks to all!
Also, just wanted to mention how bad ass this forum is. I'm in a summer school class right now, and the school's Help Center has been closed all summer. So far, this forum has been extremely...
I actually previously implemented this as char zztop[30], and I got it to print just fine within main. But how exactly am I going to pass zztop[30] into the insert function? I can't pass an array...
Oh, so does that mean that the string entered will be lost and unreachable outside of the main function? How do I avoid this, or how do I allocate memory for this? I can't imagine I'd be using a...
The first printf statement inside main seems to work fine. How should I be printing zztop there otherwise?
I removed the ampersand before value in the second printf statement located in the...
I am trying to pass a string to this function:
void insert(ListNodePtr *sPtr, char *value);
I am gathering the string from scanf, printing it, and then passing it to the function like so...
Very helpful, thank you all!
I am currently working on a project that works very much like a text adventure. Each room in the "world" is a structure defined as follows:
typedef struct Area
{
char *name; //name of...