首页 > 其他分享 >typedef struct 和struct

typedef struct 和struct

时间:2024-03-25 13:58:31浏览次数:18  
标签:typedef struct int 50 char book Books

1.typedef struct:

struct Books
{
   char  title[50];
   char  author[50];
   char  subject[100];
   int   book_id;
} book;

例如:

typedef struct {
  char title[50];
  char author[50];
  int book_id;
} Books;

Books myBook;

2. struct:

struct tag {

    member-list
    member-list
    member-list  
    ...
} variable-list ;

例如:

  struct Books {

    char title[50];
    char author[50];
    int book_id;
  };

  struct Books myBook;

当然,初始化时,也可以直接

 struct Books {

    char title[50];
    char author[50];
    int book_id;
  }abc;不用再单独的 struct Books abc;

N:strcpy函数:把字符串赋值给结构体变量

C 结构体 | 菜鸟教程 (runoob.com)

 

 

 注意指针*和地址符&  !!!        2024-03-12

 

标签:typedef,struct,int,50,char,book,Books
From: https://www.cnblogs.com/NevMore/p/18068258

相关文章

  • Array Destruction(枚举暴力,stl的合理选择)
    Youfoundauselessarray aa of 2n2n positiveintegers.Youhaverealizedthatyouactuallydon'tneedthisarray,soyoudecidedtothrowoutallelementsof aa.Itcouldhavebeenaneasytask,butitturnedoutthatyoushouldfollowsomerules:I......
  • 数据结构预备知识3--typedef、结构体
    typedef:typedef用来干什么:我们常用typedef来赋予数据类型一个新的名字,来方便我们的使用typedef的用法:typedef 数据类型  新的名字;举例说明: 代码:#include<iostream>usingnamespacestd;intmain(){ typedefintzheng_shu; zheng_shua=1; intb=1;......
  • 20240323, 结构STRUCT,
    二,结构2.1结构类型2.1.1声明结构类型:函数内声明只能函数内使用,通常声明在函数外部,可以多个函数一起使用#include<stdio.h>intmain(){ structdata{ intmouth; intday; intyear; }; //不要忘记分号 structdatatoday; today.mouth=07; today.day=......
  • 对象Constructor构造函数解析详解
    构造函数解析构造函数解析示例,code如下。定义实体类:packagecom.gientech.constructor;publicclassPerson{privateStringname;privateintid;privateintage;privateStringsex;publicPerson(){}publicPerson(String......
  • A Tale of Two Graphs: Freezing and Denoising Graph Structures for Multimodal Rec
    目录概FREEDOMMotivationFrozenItem-ItemgraphDenoisingUser-ItemBipartiteGraphTwoGraphsforLearning代码ZhouX.andShenZ.Ataleoftwographs:Freezinganddenoisinggraphstructuresformultimodalrecommendation.概本文主要是对LATTICE的改进.FREE......
  • Swift Structured Concurrency
    异步函数异步函数概念异步和并发是两个不同的概念,并发(Concurrency)是指多个任务同时执行,这里的同时不是严格意义上的同一时刻,而是在稍大时间粒度上,多个任务可以同时推进,并发的实现可以是单线程,也可以是多线程、多核、多设备。在Swift中,异步函数是一种特殊的函数,它可以在执行过......
  • 【大语言视觉助手+LLaVA1.5】23.10.LLaVA-1.5改善后视觉语言大模型: Improved Baselin
    LLaVa家族官方资源汇总:项目主页||https://huggingface.co/liuhaotian23.04.LLaVA1.0论文:LargeLanguageandVisionAssistant(VisualInstructionTuning)23.06LLaVA-Med(医学图片视觉助手):TrainingaLargeLanguage-and-VisionAssistantforBiomedicineinOne......
  • Uncaught SyntaxError: Invalid destructuring assignment target
    UncaughtSyntaxError:Invaliddestructuringassignmenttarget 这个问题是由于一个二维数组中,一个应该是逗号的地方,放了一个],废了几个小时才找到问题,真的是无语了.模拟一下案情:正确的是这样的:vararray=[[1,2,3],[4,5,6],[7,8,9]]却错误的变成了这样:vararray=[[......
  • VUE前端打包报错:TypeError: Class extends value undefined is not a constructor or
    在执行npmrunbuild的时候遇到了错误:TypeError:Classextendsvalueundefinedisnotaconstructorornull;而执行npmrunserve是可以正常执行的,报错如下:buildingforproduction...ERRORTypeError:ClassextendsvalueundefinedisnotaconstructorornullTypeErr......
  • 深入了解指针(3)【数组指针变量】【函数指针变量】【typedef关键字】
    一.数组指针变量1.什么是数组指针变量?说到数组指针,那必然要说一下指针数组,指针数组是什么呢?指针数组是一种数组,只不过这种数组存放的是地址(指针)。那把这两个词反过来,数组指针是什么?它是指针变量,还是数组?答案是:指针变量。这个指针有些特殊,它存放的是数组的地址,它是能够指向数......