944,105 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 1274
  • C RSS
Mar 12th, 2006
0

@@ ListFuns.c @@

Expand Post »
Hi,

Can anyone tell me if i have done these functions correctly; i maybe missing something; maybe thats why im getting segmentation fault!!!

#include "listFuns.h"
#include <stdlib.h>
#include <stdio.h>

listADT stringToList(char str[])
/* desc: converts a C string (array of char) into the */
/* corresponding word (list of characters) */
{
listADT temp;
return temp;
}

void displayList(listADT list)
{
if(!isEmptyList(list))
{ // if the list is not empty
printf("%c", headList(list)); // print the character at the current head of the list
displayList(tailList(list)); // call the function again with the next character in the list
}
printf("\n"); //print a new line

}

boolean precedesList(listADT list1, listADT list2)
/* desc: returns TRUE if the word in list1 is alphabetically */
/* before that in list2 */
{
return FALSE;
}
boolean equalsList(listADT list1, listADT list2)
/* desc: returns TRUE if the word in list1 is equal to that */
/* in list2 */
{
return FALSE;
}
Reputation Points: 10
Solved Threads: 0
Newbie Poster
minorityreport is offline Offline
4 posts
since Mar 2006
Mar 12th, 2006
0

Re: @@ ListFuns.c @@

You'll get no help by posting partial code and complaining of a vague segmentation fault. If you don't clarify your posts, I'll remove them as spam. Also, for the same problem, keep your posts to a single thread.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Mar 12th, 2006
0

Re: @@ ListFuns.c @@

hi, i am sorry for being so broad; i am simply debugging and looking for possibilities myself of why i keep getting segmentation fault!

i am new to this forum; thanks for advicing me on the do's and dont's; i looked at the listfuns.c and thought i might be missing something from the instruction.

can you advise me where i may have gone wrong?

thanks
Reputation Points: 10
Solved Threads: 0
Newbie Poster
minorityreport is offline Offline
4 posts
since Mar 2006
Mar 13th, 2006
2

Re: @@ ListFuns.c @@

Um, why would you even expect this code to work? Do equalsList, precedesList, and stringToList work as advertised?
Team Colleague
Reputation Points: 1135
Solved Threads: 172
Super Senior Demiposter
Rashakil Fol is offline Offline
2,479 posts
since Jun 2005
Mar 13th, 2006
0

Re: @@ ListFuns.c @@

>can you advise me where i may have gone wrong?
All of the code you've posted consists of either statements that cannot cause a seg fault, or user-defined function calls. The only conclusion is that the fault is in one of those functions, but because you haven't posted the code for any of them, we can't help you. This isn't a difficult concept.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Mar 13th, 2006
0

Re: @@ ListFuns.c @@

hi, i have got the programme working;
thanks
Reputation Points: 10
Solved Threads: 0
Newbie Poster
minorityreport is offline Offline
4 posts
since Mar 2006
Mar 13th, 2006
0

Re: @@ ListFuns.c @@

>i have got the programme working
And? I'm quickly beginning to think you're a troll. First you post code that can't be debugged due to lack of information, then you say you've fixed the problem but don't bother to tell us where or what it was.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: a simple C program to create/open/write/close files generaing basic arithmetic ops
Next Thread in C Forum Timeline: Hollow box program updated





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC