#Help with C program for job application

32 messages · Page 1 of 1 (latest)

gray panther
#

Input: telephones telegram telecommunication
2nd input: tele
expected output: telecommunication telegrames telephones
actual output: telephones telegram telecommunication

This program is supposed to prompt the user for a sentence as I showed in the input, then it adds it to a linked list which I call a dictionary.

It will then prompt the user to look up words using 4 or less letters which I have shown in 2nd input, it will then alphabetize the words and spit them back out.

Everything works except the alphabetizing of the words in the linked list.

chilly rampartBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

gray panther
#
    char data[MAX_WORD_LEN];
    struct node *next;
};
typedef struct node Node;

struct linkedlist {
    Node *head;
    size_t size;
};
typedef struct linkedlist List;```

lines 7-17 is to create a List? or is it just line 17 that does it
loud jasper
#

We're never creating anything

#

We're just declaring stuff

gray panther
#

what is List in the C syntax

#

from Java knowledge its a class

loud jasper
#

List is just an arbitrary word

gray panther
#

why is it not lowercase

loud jasper
#

I could've just as well written

typedef struct linkedlist abcdefg
#

But you probably don't want to write abcdefg everytime

gray panther
#

your naming convention is what confused me, I've never seen a variable written with a capital letter

loud jasper
gray panther
#

it made me think it was a class LOL

#

I gotcha

loud jasper
#

typedef a b allows you to introduce a new name b for a type a

gray panther
#

I see

loud jasper
#

In my case I first constructed the type struct node, then I said that instead of stuct node I'd like to be able to write Node

gray panther
#

that makes sense

loud jasper
#

I can still write struct node, but Node now refers to the same datatype

gray panther
#

so now I have to add the fgets and such

loud jasper
#

that's already in the main

gray panther
#

I'm just gonna add some basic like

"hey bro put a sentence"

"hey bro gimme 4 letters to look up"

loud jasper
#

Ah yeah, I haven't put print statements to ask the user

#

Just put those before the fgets calls

gray panther
#

before 114 and 128?

#

If I get this job how can I show my gratuity. I don't have money right now, but let me know something within reason and I can definitely do it

loud jasper
#

That was just an hour or so. Dw about it

chilly rampartBOT
#

This question is being automatically marked as stale.
If your question has been answered, run !solved.
If your question is not answered feel free to bump the post or re-ask.
Take a look at !howto ask for tips on improving your question.

gray panther
#

!solved