博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Android 下 JNI 开发
阅读量:4046 次
发布时间:2019-05-25

本文共 993 字,大约阅读时间需要 3 分钟。

19、枚举-3

enum WeekDay {

     Monday=0,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday

};

 

main() {

       enum WeekDay day = Sunday;

       printf("%d\n",day);

       system("pause");

}

枚举中的值是递增的。

枚举默认是从0开始

 

20、Typedef别名-4

声明自定义数据类型,配合各种原有数据类型来达到简化编程的目的的类型定义关键字。

在计算机编程语言中用来为复杂的声明定义简单的别名;

#include <stdio.h>

#include <stdlib.h>

typedef int i;

typedef long l;

main() {

       i m = 10;

       l n = 123123123;

       printf("%d\n", m);

       printf("%ld\n", n);

       system("pause");      

}

 

21、结构体指针-10

#include<stdio.h>

#include<stdlib.h>

/**

结构体指针

*/

 

//定义一个结构体

struct Student{

       int age;

       float score;

       char  sex;      

}       

main()

{      //结构体

      struct Student stu = {20,88.5,'W'};

      printf("stu.age=%d\n",stu.age);

 

      //结构体指针

      struct Student* stuPoint;

      //赋地址值

      stuPoint = &stu;

      //取值  (*stuPoint).age     

      printf("(*stuPoint).age=%d\n",(*stuPoint).age);

      //赋值 (*stuPoint).age =80;

 

      //另外一种取值 (*stuPoint).等价于 stuPoint-> 例如:

      //(*stuPoint).age 等价于 stuPoint->age

      printf("stuPoint->age=%d\n",stuPoint->age);

      system("pause");    

}    

 

运行结构如下:

 

 

(*stuPoint).age 等价于 stuPoint->age

 

 

 

本教程由尚硅谷教育大数据研究院出品,如需转载请注明来源。

你可能感兴趣的文章
苹果Swift编程语言入门教程【中文版】
查看>>
捕鱼忍者(ninja fishing)之游戏指南+游戏攻略+游戏体验
查看>>
iphone开发基础之objective-c学习
查看>>
iphone开发之SDK研究(待续)
查看>>
计算机网络复习要点
查看>>
Variable property attributes or Modifiers in iOS
查看>>
NSNotificationCenter 用法总结
查看>>
C primer plus 基础总结(一)
查看>>
剑指offer算法题分析与整理(三)
查看>>
Ubuntu 13.10使用fcitx输入法
查看>>
pidgin-lwqq 安装
查看>>
mint/ubuntu安装搜狗输入法
查看>>
C++动态申请数组和参数传递问题
查看>>
opencv学习——在MFC中读取和显示图像
查看>>
C/C++中关于动态生成一维数组和二维数组的学习
查看>>
JVM最简生存指南
查看>>
Java的对象驻留
查看>>
JVM并发机制探讨—内存模型、内存可见性和指令重排序
查看>>
持续可用与CAP理论 – 一个系统开发者的观点
查看>>
nginx+tomcat+memcached (msm)实现 session同步复制
查看>>