⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stdb.c

📁 C.Game.Programming.For.Dummies.原码
💻 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 + -