089.Struct Array 结构体数组
来源:互联网 发布:淘宝网收藏店铺代码 编辑:程序博客网 时间:2024/06/14 06:42
--------------- main.m ---------------
#import<Foundation/Foundation.h>
intmain()
{
struct point
{
int x;
int y;
{
struct point
{
int x;
int y;
};
typedefstructpoint FKPoint;
FKPoint points[] = {
{20, 30},
{12, 20},
FKPoint points[] = {
{20, 30},
{12, 20},
{4, 8}
};
// points[1] = {20 , 8}; // 这句代码是错误的
points[1].x =20; //单独对结构体变量的单个成员赋值是允许的
points[1].y =8; //单独对结构体变量的单个成员赋值是允许的
for(inti = 0 ; i < 3 ; i++)
{
NSLog(@"points[%d]的x是:%d, points[%d]的y是:%d"
, i , points[i].x, i , points[i].y);
}
{
NSLog(@"points[%d]的x是:%d, points[%d]的y是:%d"
, i , points[i].x, i , points[i].y);
}
}
一、编写本节代码的具体步骤:
1.参照003节的代码编写步骤。
二、本节代码涉及到的知识点:
1.在定义结构体变量之后,对结构体变量整体赋值是不允许的。
2.无论何时,只要是对结构体变量(包括结构体数组的元素)的单个成员赋值,都是允许的。
0 0
- 089.Struct Array 结构体数组
- 089.Struct Array 结构体数组
- struct 结构体中 数组和指针
- struct 结构体中 数组和指针
- Matlab新建struct结构体数组
- matlab 结构(struct)数组
- struct 结构数组
- matlab结构(struct)数组
- matlab 结构(struct)数组
- MATLAB中使用结构体 -- 结构(struct)数组
- Matlab中的结构(struct)数组
- rails 结构体 Struct 转Hash/数组检测为空
- 用结构体struct(数组)实现桶排序
- 【Struct(结构体)杂谈之七】Struct中0元素数组的意义在哪里?
- 结构体(struct) 用法
- 结构体struct module
- 什么结构体 struct
- struct结构体
- 086.Struct 一步定义结构体
- 学习笔记——一个简单的还原短信的Android应用出现的问题
- 087.Typedef 另起名称简化代码
- 088.Init Struct 初始化结构体
- Android studio 1.3 NDK开发
- 089.Struct Array 结构体数组
- 090.Block 定义块的三种方式
- Ubuntu下图形界面配置IP
- 091.Block And Var 块与局部变量
- 092.Block And Var 块中修改局部变量
- 093.Typedef Block Type 定义块类型
- c/c++指针
- 094.Block Argument 块作为函数参数
- ZigZag Conversion