上一页 1 2 3 4 5 6 7 8 ··· 29 下一页

2017年5月24日

OC 类 的声明

摘要: Student.h 阅读全文

posted @ 2017-05-24 16:37 守望星空 阅读(169) 评论(0) 推荐(0) 编辑

OC extern和函数

摘要: #include // 定义一个one函数 // 完整地定义一个外部函数需要extern关键字 //extern void one() { // printf("调用了one函数\n"); //} // 默认情况下就是外部函数,所以可以省略extern void one() { printf("调用了one函数\n"); } #ifndef extern___... 阅读全文

posted @ 2017-05-24 16:33 守望星空 阅读(231) 评论(0) 推荐(0) 编辑

OC extern和变量

摘要: 注意: extern只能用来声明全部变量,不能拿来定义变量 阅读全文

posted @ 2017-05-24 16:31 守望星空 阅读(164) 评论(0) 推荐(0) 编辑

OC 枚举

摘要: void test() { // 定义一种枚举类型 enum Season {spring, summer, autumn, winter}; // 定义一个枚举变量s enum Season s = winter; } void test1() { // 定义枚举类型的同时定义一个枚举变量s enum Season {spring... 阅读全文

posted @ 2017-05-24 16:28 守望星空 阅读(116) 评论(0) 推荐(0) 编辑

OC 结构体

摘要: void test() { // 这个机构只能在函数内部使用 // 定义一个名为Student的结构体类型 struct Student { int age; // 年龄 char *name; // 姓名 float height; // 身高 }; // 定义一个结构体变量 struct... 阅读全文

posted @ 2017-05-24 16:27 守望星空 阅读(274) 评论(0) 推荐(0) 编辑

OC 构造方法

摘要: #import @interface Student : NSObject { int _age; int _no; } - (void)setAge:(int)age; - (int)age; - (void)setNo:(int)no; - (int)no; // 自己写一个构造方法 - (id)initWithAge:(int)age andNo:(int)n... 阅读全文

posted @ 2017-05-24 16:25 守望星空 阅读(153) 评论(0) 推荐(0) 编辑

OC 方法声明使用

摘要: Person.h Person.m 阅读全文

posted @ 2017-05-24 16:23 守望星空 阅读(152) 评论(0) 推荐(0) 编辑

C语言 变量类型

摘要: // a是一个全局变量,静态变量 int a; void test() { // b是一个局部变量,自动变量 int b = 0; b++; // c是一个局部变量,静态变量 static int c = 0; c++; printf("b=%d, c=%d\n", b, c); } int main(int a... 阅读全文

posted @ 2017-05-24 16:16 守望星空 阅读(184) 评论(0) 推荐(0) 编辑

C语言 字符串处理函数

摘要: #include #include // strlen void test() { // 测量字符串常量的字符长度(不包括\0这个字符) int len = strlen("李某某"); //printf("%d\n", len); // 测量字符串变量的字符长度 char s[] = "lmj"; //printf("%d\... 阅读全文

posted @ 2017-05-24 16:15 守望星空 阅读(180) 评论(0) 推荐(0) 编辑

C语言 Include指令(引用头文件)

摘要: #include "one.h" #include "two.h" int main(int argc, const char * argv[]) { one(); two(); return 0; } 阅读全文

posted @ 2017-05-24 16:13 守望星空 阅读(695) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 ··· 29 下一页

导航