| | |
@@ ListFuns.c @@
![]() |
•
•
Join Date: Mar 2006
Posts: 4
Reputation:
Solved Threads: 0
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;
}
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;
}
•
•
Join Date: Mar 2006
Posts: 4
Reputation:
Solved Threads: 0
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
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
>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.
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.
I'm here to prove you wrong.
![]() |
Other Threads in the C Forum
- Previous Thread: a simple C program to create/open/write/close files generaing basic arithmetic ops
- Next Thread: Hollow box program updated
| Thread Tools | Search this Thread |
* adobe ansi api array asterisks binarysearch calculate centimeter char character cm convert copyanyfile copyimagefile copypdffile cprogramme createcopyoffile createprocess() csyntax directory feet fflush fgets file floatingpointvalidation fork frequency givemetehcodez global gtkgcurlcompiling gtkwinlinux hacking highest homework i/o inches infiniteloop input interest intmain() iso keyboard kilometer km linked linkedlist linux linuxsegmentationfault list locate lowest match meter microsoft mqqueue mysql number oddnumber odf open opendocumentformat openwebfoundation owf pattern pdf performance posix power probleminc program programming pyramidusingturboccodes read recv recvblocked repetition reversing scanf scheduling segmentationfault send single socketprograming socketprogramming stack standard string suggestions systemcall unix urboc user variable voidmain() wab whythiscodecausesegmentationfault win32api windows.h windowsapi






