大佬教程收集整理的这篇文章主要介绍了c – 无法释放内存,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
int LuffarschackStart(void) { /* to avoid the program from closing */ char readEnd; int i = 0; board_type *board = malloc(sizeof(square_typE)); if (board == NULL) { printf("Could not allocate the memory needed..."); scanf("%c",&readEnd); return 0; } for(i = 0; i < 9; i = i + 1) board->square[i].piece_type = NO_PIECE; board_play_game(board); free(board); printf("Press any key and enter to quit the program..."); scanf("%c",&readEnd); return 0; }
我分配的板结构如下所示:
typedef struct { /* flag to inDicate if a square is free or not */ int free; /* the type of piece stored on the square if the square is not free,in this case the admissible values are CROSS_PIECE and CIRCLE_PIECE,otherwise the value NO_PIECE is used */ int piece_type; } square_type; typedef struct { square_type square[N_SQUARES]; int computer_type; int player_type; } board_type;
以上是大佬教程为你收集整理的c – 无法释放内存全部内容,希望文章能够帮你解决c – 无法释放内存所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。