如何在C中更改数组的大小? [英] How can I change the size of an array in C?

查看:26
本文介绍了如何在C中更改数组的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 gamestudio.我现在正在制作一个射击游戏.我有一个指向敌人的指针的数组.当敌人被杀死时,我想将他从列表中删除.而且我还希望能够创造新的敌人.

I am experimenting a little bit with gamestudio. I am now making a shooter game. I have an array with the pointers to the enemies. When an enemy is killed, I want to remove him from the list. And I also want to be able to create new enemies.

Gamestudio 使用名为 lite-C 的脚本语言.它具有与 C 相同的语法,并且在他们的网站上说,它可以使用任何 C 编译器进行编译.它是纯 C 语言,没有 C++ 或其他任何东西.

Gamestudio uses a scripting language named lite-C. It has the same syntax as C and on the website they say, that it can be compiled with any C compiler. It is pure C, no C++ or anything else.

我是 C 的新手.我通常使用 .NET 语言和一些脚本语言进行编程.

I am new to C. I normally program in .NET languages and some scripting languages.

推荐答案

C 中的数组一旦被创建,就会被设置.您需要一个动态数据结构,如链表或 ArrayList

Once an array in C has been created, it is set. You need a dynamic data structure like a Linked List or an ArrayList

这篇关于如何在C中更改数组的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆