#Error in my code

8 messages · Page 1 of 1 (latest)

clever bearBOT
#

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.

quick oak
#

;compile c

jade pebbleBOT
#
Compiler Output
<source>: In function 'remove_student':
<source>:107:20: error: expected '{' before '*' token
  107 |             struct *snode temp1;
      |                    ^
<source>:108:13: error: 'temp1' undeclared (first use in this function)
  108 |             temp1 = lst -> front;
      |             ^~~~~
<source>:108:13: note: each undeclared identifier is reported only once for each function it appears in
<source>:109:20: error: expected '{' before '*' token
  109 |             struct *snode tempNext;
      |                    ^
<source>:110:13: error: 'tempNext' undeclared (first use in this function)
  110 |             tempNext = lst->front->next;
      |             ^~~~~~~~
Build failed
quick oak
#

start at the top

rain pagoda
#

?

#

I'm not sure what these error messages supposed to mean...

#

I didn't write much comments about each function but this is what each function does:

// create_list() returns an empty newly-created list of students
// note: caller must free using free_list

// insert_student(id, name, lst) attempts to add a student with given id and
// name into the given list lst; if a student with that id is already in the
// list then return false, otherwise lst is modified and true is returned

// remove_student(id, lst) attempts to remove a student with given id from the
// given list and free the memory allocated to that student; true is returned
// if successful and false otherwise

// find_student(id, lst) returns the name of the student with given id in the
// given list lst in a dynamically-allocated string (that the caller must
// .free) or NULL if no student has that id

// free_list (lst) deallocates all memory associated with the given list lst
// including the memory used by the student records in the list

clever bearBOT
#

@rain pagoda

Please Do Not Delete Posts!

Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. You can use !solved to close a post and mark it as solved.