这个程序运行不了
程序代码:
#include<stdio.h> #include<time.h> #include<stdlib.h> #include<windows.h> void creat_food(); char tn = 3; struct Snake { int x; int y; }; void gotoxy(int x,int y); void main() //主函数 { creat_food(); } void creat_food() //产生食物 { struct Snake * food; srand(time(NULL)); food -> x = rand()%38+1; food -> y = rand()%13+1; gotoxy(food -> x,food -> y); printf("%c",tn); } void gotoxy(int x,int y) //移动光标 { HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE); COORD loc={x,y}; SetConsoleCursorPosition(hOut,loc); }