Guest User

Untitled

a guest
Aug 16th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. typedef struct snake //this struct holds the information of a 'body part' of
  5. the snake
  6. {
  7. int x;
  8. int y;
  9. char movingDirection; // u == up, d == down, l == left, r == right
  10. }snake;
  11.  
  12.  
  13. int main()
  14. {
  15. //Variables
  16. char command;
  17. char *map = (char *)malloc(sizeof(char) * 1364);
  18. int width = 62;
  19. int height = 22;
  20. snake *head = calloc(1, sizof(snake)); //error occurs here
  21.  
  22.  
  23. while (1)
  24. {
  25. scanf_s(" %c", &command);
  26. switch (command)
  27. {
  28. case 'p':
  29. system("CLS");
  30. break;
  31.  
  32. case 'q':
  33.  
  34. return 0;
  35. break;
  36. }
  37. }
  38. return 0;
  39. }
Add Comment
Please, Sign In to add comment