Thats kind of what I want it do. Lets say input the following 4 messages:
1 5 message1
5 10 message2
1 6 message3
2 7 message4
The first number being the priority, I want to be able to list...
Type: Posts; User: CMakesMeSad :(
Thats kind of what I want it do. Lets say input the following 4 messages:
1 5 message1
5 10 message2
1 6 message3
2 7 message4
The first number being the priority, I want to be able to list...
Hey everyone, Ive been working on this all day and have made some good progress, however Im stuck again. Im working on the option of listing the messages by priority. However, no matter what priority...
the value of postion is -1 which makes absolutely no sense. ill have to do something about this, thanks :)
Ah sorry, it was originally:
scanf("%d", &messages[position].priority);
I did take your advice the first time, i was just messing around with different things since I couldnt even get...
sorry guys, heres what i have now
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct MSG {
int priority;
int destination;
Thanks, Ill definitely look into it!
I removed everything and just put this:
printf("Enter priority:\n");
scanf("%d", &std[I].priority);
I still get a segmentation fault as soon as I enter a number
I noticed that, in my code they're both "I" but when I post it hear they convert to "i"s for some reason. I get to the point where I add a new message, tell it how many messages I want to add, then...
Im here to learn so if you have better alternatives id love to hear them :)
Thanks for the help guys, I have this code now which freezes after I input the values:
#include <stdio.h>
#include <string.h>
int main ()
{
struct MSG {
Im getting a segmentation fault when I try to run the program and add new message. As soon as I input the 3 values it segfaults. Any help?
#include <stdio.h>
#include <string.h>
struct...
Kind of getting there. This code outputs the first word but it gets stuck in a looping cycle
#include <stdio.h>
#include <string.h>
#define MAXLENGTH 256
#define delimiter ""
I got it! Sort of. So the code below does this now:
Hello world
Hello
world
Which is exactly what I want the program to do but not the way it currently does it.
#include <stdio.h>...
Im going to try to finish the current program since it seems like im having trouble even using the strtok function. I fixed the compiling errors that i was receiving, but im still segfaulting when I...
This might be a stupid question, but I was thinking, would it be possible to use strtok within that function? I know how to make this program using strtok, so it would be awesome if i could just...
It does not have to work like strtok, thats the only thing i could find to get me started. The only requirement is it have this function:
char *next_word(char *instring, char **new_start)
Do...
so char* parsed=instring;?
Ill definitely be uncommenting the print statements once this program makes it to that point lol
Okay I think I got it, but it gives me the assignment makes integer from pointer w/o cast error. Also, I believe Im getting a segmentation fault after I type in my sentence.
#include <stdio.h>...
yeah honestly I had no idea what I was doing with calling the function. Now I feel like my strtok code isnt going to work properly :( Is there a way I can test it without calling it into the main...
Hi everyone. I'm writing this program that takes a sentence and breaks it up into words and spits that out in a vertical column. I couldn't use the "strtok" function so I wrote one from scratch....