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

📄 strucarr.c

📁 里面包含很多c语言的源码
💻 C
字号:
/* Demonstrates using arrays of structures. */

#include <stdio.h>

/* Define a structure to hold entries. */

struct entry {
    char fname[20];
    char lname[20];
    char phone[10];
};

/* Declare an array of structures. */

struct entry list[4];

int i;

int main( void )
{

    /* Loop to input data for four people. */

    for (i = 0; i < 4; i++)
    {
        printf("\nEnter first name: ");
        scanf("%s", list[i].fname);
        printf("Enter last name: ");
        scanf("%s", list[i].lname);
        printf("Enter phone in 123-4567 format: ");
        scanf("%s", list[i].phone);
    }

    /* Print two blank lines. */

    printf("\n\n");

    /* Loop to display data. */

    for (i = 0; i < 4; i++)
    {
         printf("Name: %s %s", list[i].fname, list[i].lname);
         printf("\t\tPhone: %s\n", list[i].phone);
    }

    return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -