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

本文介绍了iOS开发中C语言的基础知识,包括变量定义的基本语法及规范,通过实例演示了如何定义和初始化不同类型的变量。

iOS从零基础到精通就业-C语言入门

 (学习路径http://blog.youkuaiyun.com/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;
}




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值