Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- typedef struct snake //this struct holds the information of a 'body part' of
- the snake
- {
- int x;
- int y;
- char movingDirection; // u == up, d == down, l == left, r == right
- }snake;
- int main()
- {
- //Variables
- char command;
- char *map = (char *)malloc(sizeof(char) * 1364);
- int width = 62;
- int height = 22;
- snake *head = calloc(1, sizof(snake)); //error occurs here
- while (1)
- {
- scanf_s(" %c", &command);
- switch (command)
- {
- case 'p':
- system("CLS");
- break;
- case 'q':
- return 0;
- break;
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment