ok. I will try and make some improvements. Do you know of a good reference, be it book or website, for implementing linked lists and binary trees in C? My implementation is pretty much based off of...
Type: Posts; User: christianB
ok. I will try and make some improvements. Do you know of a good reference, be it book or website, for implementing linked lists and binary trees in C? My implementation is pretty much based off of...
I have taken a data structures class which focused primarily on implementing in java but I am trying to apply my knowledge by implementing a few structures in a different language.
currently I am...
#include <stdio.h>
#include <string.h>
#define MAX_NAMES 10
#define MAX_LEN 20
typedef struct {
char first[MAX_NAMES];
char last[MAX_NAMES];
}Name;
yeah, i wish I could. I just sent him an email. this is an all online course, and over 6 weeks it's been insane. I've finished all the assignments except this one, but If i don't finish it by today i...
he has MAX_LEN and MAX_NAMES defined that way and he also defines Name names as having dimension [MAX_NAMES]. it's nothing that i can change.
he has them defined like that for some reason. Not sure why.
fixed. i'm really not sure how I could shorten that anymore. I have to check both the first and last names. Now it just prints out the second name I enter for all the elements of my array. I've...
ok, so this is what I have.
#include <stdio.h>
#include <string.h>
#define MAX_NAMES 10
#define MAX_LEN 20
typedef struct {
ok, so I think i'm supposed to keep name.first and name.last to build new array. i will compare all of the names in names[MAX_NAMES]. if all of the names in the array are differnet from name, then...
i forgot about those functions. I can't delete that printf though, it's part of the code that my professor provided for us. That's partly why I am stuck. I don't understand why I need that scanf,...
ok, so first i need to scan in an array of name pairs. So i have this:
#include <stdio.h>
#define MAX_NAMES 10
#define MAX_LEN 20
typedef struct {
not asking anyone to do it for me, i'm just asking for some direction. I'm just not sure how to start based on the variables I'm given. I'm just hoping for some advice. Thanks.
Hello, I have one more problem this semester that I need to complete or else i automatically fail my class and it is stumping me. I don't even know how to begin. Here is my code that is already...
of course. i'm just being redundant. it works now. thanks for all the help. I changed DIM to 4 because I was tired of typing 16 numbers over and over to test it. 16 is supposed to be a %d that reads...
so this should work right?
#include <stdio.h>
#define DIM 4
int main() {
so because I didn't have "ndx < DIM" as a condition in the loop it was going on past the 15th index of both the arrays? It was just my luck that those values happened to be equal huh? I understand...
those braces are unnecessary i guess. so you're saying i'm not asking for "equal/not equal" based on weather or not the indices are equal, but only if my counter gets up to a number I want it to?
...
I have an assignment that requires me to write code that compares two arrays and confirms if every element in the first is equal to every element in the second. this is my code.
#include...
i see. quzah, i wasn't saying that what you posted was wrong, rather I was coming up with the wrong code. Thank you so much to everyone for all of your help. I know I probably frustrated the hell out...
i'm not sure I understand what Quzah gave me.
while input
if !count && isodd input
ok = true
count++
if isodd input != isodd count
ignore everything until EOF...
this is what I have come up with so far.
odd = 1; /*one character
ok = 1; shy of limit*/
while (EOF != scanf("%d", &val)) {
if (odd == val % 2 && val != val % 2) ...
by flag you mean, if first int is odd, and second int is even, everything ok.
would it be possible to do all of that in only two lines?
1. scan int
2. check if current int = odd
3. scan new int
4. check if new int is even (or opposite old int, or not odd)
1. scan for an integer.
2. check if integer is odd or even.
3. scan second integer.
4. check if integer is odd or even.
5. if first int is odd, and second int is even, everything ok.
if...
okay guys, i've been working on it for a while and I keep arriving at the same kind of problem. I keep coming up with code that just checks for odd or even numbers, but no particular sequence. I know...