您的位置:首页 > 编程语言 > C语言/C++

iOS从零基础到精通就业-C语言入门 1 变量的定义

2016-12-08 14:55 232 查看
iOS从零基础到精通就业-C语言入门
 (学习路径http://blog.csdn.net/lanouluanbin/article/details/53518018)
1 变量的定义

//
// main.m
// 变量的定义
//
// Created by 蓝鸥 on 16/7/21.
// Copyright © 2016年 luanbin. All rights reserved.
//

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {

//变量的定义
//语法
//变量的类型 变量的名字 = 初值值;
int age = 18;
char sex = 'm';
sex = 'f';
/*
规范
1,名字只能有数字,字母,下划线,美元符号构成,并且不能以数字开头
2,见名知意
3,驼峰命名法
4,先定义后使用
5,变量不能重名
*/
int a1 = 10;
int b1 = 20;

float studentScore = 99.5;
studentScore = 89.5;
studentScore= 79.5;

//teacherScore = 999.5;
//float studentScore = 66.6;

return 0;
}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息