在程序中多次出現(xiàn)如下代碼:memory->destroy (BOP_index);memory->create (BOP_index,nall,"BOP_index");還有int *tag = atom->tag;int timestep = update->ntimestep;int newton_pair = force->newton_pair;很困惑->在這里是什么意思,有什么作用,請高手解答
1 回答

當年話下
TA貢獻1890條經驗 獲得超9個贊
->是指針的指向運算符,通常與結構體一起使用。
具體使用方法可以參考如下程序:
#include<stdio.h>
struct stu // 定義一個結構體
{
char name[10]; // 姓名
int num; // 學號
int age; // 年齡
};
void main()
{
struct stu *s; // 定義一個結構體指針
char str[]="ZhangLi";
s->name = str; // 對結構體中的成員變量name進行賦值
s->num = 2015120; // 對結構體中的成員變量num進行賦值
s->age = 18; // 對結構體中的成員變量age進行賦值
}
- 1 回答
- 0 關注
- 817 瀏覽
添加回答
舉報
0/150
提交
取消