📄 stdb.c
字号:
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
void main()
{
struct st_info {
int number;
char name[30];
char description[128];
};
struct st_info *episode;
puts("My Star Trek Database");
episode = (struct st_info*)malloc(sizeof(struct st_info));
if(episode==NULL)
{
puts("No more memory, dude!");
exit(0);
}
/* Fill the structure using pointers */
episode->number = 29;
strcpy(episode->name,"Operation: Annihilate!");
strcpy(episode->description,"The one where they beam down to the planet.");
/* Display the data */
printf("Star Trek Episode %i\n",episode->number);
printf("\"%s\"\n",episode->name);
printf("Description: %s\n",episode->description);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -