Advertisement
dmesticg

Constructors.c

Nov 30th, 2020
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include "headers.h"
  2.  
  3.  
  4. struct sentence *newSentence(struct word *firstWord,int sentenceNum, int wordCount) {
  5.  
  6. struct sentence *new = NULL;
  7. new = malloc(sizeof(struct sentence));
  8.  
  9. if (new != NULL) {
  10. new->firstWord = firstWord;
  11. new->lineNum = sentenceNum;
  12. new->wordTotal = wordCount;
  13. new->nextSent = NULL;
  14. // printf("new sentence constructed\n");
  15. // fflush(stdout);
  16. }
  17. return new;
  18. }
  19.  
  20. struct word *newWord(char *letters, int charNum, int location) {
  21.  
  22. struct word *new = NULL;
  23. new = malloc(sizeof(struct word));
  24.  
  25. if (new != NULL) {
  26. new->str = letters;
  27. new->length = charNum;
  28. new->pos = location;
  29. new->nextWord = NULL;
  30. // printf("new word constructed\n");
  31. // fflush(stdout);
  32. }
  33. return new;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement