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

📄 func.c

📁 里面包含很多c语言的源码
💻 C
字号:
/* Demonstrates passing a structure to a function. */

#include <stdio.h>

/* Declare and define a structure to hold the data. */

struct data {
    float amount;
    char fname[30];
    char lname[30];
} rec;

/* The function prototype. The function has no return value, */
/* and it takes a structure of type data as its one argument. */

void print_rec(struct data displayRec);

int main( void )
{
    /* Input the data from the keyboard. */

    printf("Enter the donor's first and last names,\n");
    printf("separated by a space: ");
    scanf("%s %s", rec.fname, rec.lname);

    printf("\nEnter the donation amount: ");
    scanf("%f", &rec.amount);

    /* Call the display function. */
    print_rec( rec );

    return 0;
}
void print_rec(struct data displayRec)
{
    printf("\nDonor %s %s gave $%.2f.\n", displayRec.fname,
            displayRec.lname, displayRec.amount);
}

⌨️ 快捷键说明

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