当前位置: 首页 > news >正文

做网站需要服务器和什么软件/百度推广搜索排名

做网站需要服务器和什么软件,百度推广搜索排名,设计网站哪个好用,wordpress 搜索标题结构体和数组都是构造类型的一种. 作为函数参数形参时: 数组传递是原数组的地址, 结构体(结构体非const指针 除外)传的是实际的数值并给了新的变量. 数组中所有元素都是同一数据类型,结构体中的成员的数据类型可以相同也可不同. 1.结构体的一般定义 (一) #include<stdio…

结构体数组都是构造类型的一种.

作为函数参数形参时: 数组传递是原数组的地址, 结构体(结构体非const指针 除外)传的是实际的数值并给了新的变量.

数组中所有元素都是同一数据类型,结构体中的成员的数据类型可以相同也可不同.

1.结构体的一般定义

(一)

#include<stdio.h>int main()
{}//结构体定义
struct {//成员列表int num;char name[20];char sex;int age;float score;char addr[30];	}sudent1,student2; //变量名列表,定义结构体变量

(二)

#include<stdio.h>int main()
{}//结构体定义
struct student{//成员列表int num;char name[20];char sex;int age;float score;char addr[30];	}sudent1,student2; //变量名列表,定义结构体变量

(三)

#include<stdio.h>int main()
{}//结构体类型声明
struct student{//成员列表int num;char name[20];char sex;int age;float score;char addr[30];	}; //定义结构体类型变量
struct student student1;
struct student student2;

(四)

#include<stdio.h>int main()
{}struct date{int month;int day;int year;
};struct student{int num;char name[20];char sex;int age;struct date birthday;float score;char addr[30];	}; struct student student1;
struct student student2;

2.结构体变量的引用(结构体变量名.成员名)

#include<stdio.h>struct date{int month;int day;int year;
};
struct student{int num;char name[20];char sex;int age;struct date birthday;float score;char addr[30];	}; struct student student1;
struct student student2;int main()
{printf("%d \n",sizeof(struct student));//struct student长度student1.num=1;// "." 成员运算符,高运算优先级student1.birthday.year=1;printf("%d %d\n",student1.num,student1.birthday.year);
}

start without debugging

3.结构体变量地址

结构体变量的地址 和 本结构体变量的第一个成员地址相同(类似数组)

#include<stdio.h>struct date{int month;int day;int year;
};
struct student{int num;char name[20];char sex;int age;struct date birthday;float score;char addr[30];	}; struct student student1;
struct student student2;int main()
{student1.num=1;student1.birthday.year=1;printf("%d %d\n",&student1.num,&student1);
}

start without debugging

3.1结构体变量的初始化

#include<stdio.h>struct {int num;char name[20];}student1,student2={1,"xxx"};//结构体变量student2初始化int main()
{printf("%d %s \n",student2.num,student2.name);student1=student2;//结构体变量s...2赋值给结构体变量s..1printf("%d %s \n",student2.num,student2.name);
}

start without debugging

4. 结构体数组 定义

#include<stdio.h>struct {char name[10];char num[3];}person[2];//结构体数组 定义int main()
{int i;for(i=0;i<2;i++){puts("input name:");gets(person[i].name);puts("input num:");gets(person[i].num);}puts("\tname\t\t\t\t\tnum\n");for(i=0;i<2;i++){printf("%20s\t\t\t%20s\n",person[i].name,person[i].num);//%20s右对齐输出字符串,左边补空格,单行占20}
}

4.1 结构体数组定义并初始化

#include<stdio.h>struct {char name[10];char num[3];}person[2]={{"a","1"},{"b","2"}};//结构体数组定义时初始化int main()
{int i;puts("\tname\t\t\t\t\tnum\n");for(i=0;i<2;i++){printf("%20s\t\t\t%20s\n",person[i].name,person[i].num);}
}

5.结构体类型指针

#include<stdio.h>struct stu{char name[10];char num[3];}person={"a","1"};int main()
{struct stu *per;//定义结构体类型指针:指向结构体类型struct stuper=&person;//结构体变量地址赋值给指针puts("\tname\t\t\t\t\tnum\n");printf("%20s\t\t\t%20s\n",person.name,person.num);printf("%20s\t\t\t%20s\n",(*per).name,per->num);//两种方式,注意方式(*per).name中的括号必须要有,因为 . 运算符的运算优先级比 * 高//用指针引用变量中的成员}

6.结构体做函数参数

6.1结构体变量做函数参数

#include<stdio.h>
#include<string.h>struct stu{char name[5];int num;float score[2];
};int main()
{int print1(struct stu a);struct stu one;one.num=8;strcpy(one.name,"abc");//易错处one.score[0]=8;one.score[1]=9;print1(one);//结构体变量做实参
}int print1(struct stu a)//结构体变量做形参
{printf("%d \n",a.num);printf("%s \n",a.name);printf("%f  %f \n",a.score[0],a.score[1]);
}

#include<stdio.h>struct stu{char *name;int num;float score[2];
};int main()
{int print1(struct stu a);struct stu one;one.num=8;one.name="abc";one.score[0]=8;one.score[1]=9;print1(one);//结构体变量做实参
}int print1(struct stu a)//结构体变量做形参
{printf("%d \n",a.num);printf("%s \n",a.name);printf("%f  %f \n",a.score[0],a.score[1]);
}

6.2结构体类型指针做函数参数

#include<stdio.h>struct stu{char *name;int num;float score[2];
};int main()
{int print1(struct stu *a);struct stu one;one.num=8;one.name="abc";one.score[0]=8;one.score[1]=9;print1(&one);//结构体变量做实参
}int print1(struct stu *a)//结构体变量做形参
{printf("重新输入一个编号(int): ");scanf("%d",&a->num );//易错处printf("%d \n",a->num);printf("%s \n",(*a).name);printf("%f  %f \n",(*a).score[0],a->score[1]);
}

7.名称优化

C语言: typedef 与 #define宏定义 .2021-06-08_慕容雪羽-CSDN博客 

http://www.jmfq.cn/news/5103361.html

相关文章:

  • 怎样制作网站二维码/今日新闻国内大事件
  • 网站建设工资待遇/网上教育培训机构排名
  • 做视频的软件模板下载网站/seo搜索引擎优化步骤
  • 高价词网站源码/二级域名免费分发
  • 可以做puzzle的网站/网站seo招聘
  • 做电影种子下载网站违法吗/最新热搜榜
  • jsp做网站用到什么技术/兰州seo整站优化服务商
  • b2c平台是什么意思/苏州seo关键词优化推广
  • 设计师查询网站/google chrome浏览器
  • 在域名做网站/百度新闻
  • 可以显示一张图片的网站怎么搭建/百度推广一个月费用
  • 网站实例/企业关键词优化最新报价
  • 厦门市app开发网站建设公司/网站推广的基本方法有
  • python在线播放/太原seo优化
  • 佛山百度网站快速优化/百度关键词价格怎么查询
  • 钢铁网站建设初衷/关键词排名优化官网
  • 福田专业网站建设公司/app营销策划方案
  • 答题做任务网站/网站建站模板
  • 宁夏建设管理局网站/搜索引擎营销分析
  • 怎么做公司网站推广/seo优化培训多少钱
  • 毕节建设网站/灰色关键词排名方法
  • 想要提高网站排名应该怎么做/关键词优化方法有什么步骤
  • 推广小程序拿佣金/济南seo外包公司
  • 北京市建委网站官网/天津seo诊断
  • 旅游网站开发目的和意义/2023年新冠疫情最新消息
  • 微网站分享功能/外贸营销型网站建设公司
  • 优惠券网站怎么做代理/网站搭建需要什么技术
  • 做shopify网站/网站的收录情况怎么查
  • php jsp动态网站开发/搜索引擎推广的三种方式
  • 怎么使网站降权/夸克搜索入口