博客
关于我
2024年大数据最全C语言高级教程-C语言数组(二)_c语言中高维数组的作用 ,2024年最新差点无缘Offer
阅读量:798 次
发布时间:2023-04-17

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

Visual Studio 2019的开发环境具有以下特点:

  • 默认安装Live Share代码协作服务:支持团队协作开发,实时同步代码。

  • 优化开发体验:新增欢迎窗口,提升代码搜索功能,整体性能更优。

  • Visual Studio IntelliCode AI助手:通过AI技术提供智能代码完成建议。

  • 改进Python支持:增强对Python虚拟机和Conda环境的支持。

  • 全面.NET Core 3.0支持:包括WinForms和WPF项目。


  • C语言数组的学习可以从以下几个方面进行:

  • 数组的定义与使用:通过代码示例展示如何定义和使用数组。

  • 数组名称引用:解释数组名称如何引用一组数值。

  • 实例演示:通过具体程序实例,掌握一维数组的定义和使用方法。


  • C语言中的寻址运算符&用于获取变量的内存地址。&广泛应用于scanf函数中,用于存储输入数据到变量中。通过在变量名称前添加&,可以获取该变量的地址。


    使用寻址运算符&

    以下程序将输出多个变量的地址:

    #include 
    #include
    int main() { system("color 3E"); long a = 1L; long b = 2L; long c = 3L; double d = 4.0; double e = 5.0; double f = 6.0; printf("A variable of type long occupies %u bytes.\n", sizeof(long)); printf("Here are the addresses of some variables of type long:\n"); printf("The address of a is: %p The address of b is: %p\n", &a, &b); printf("The address of c is: %p\n", &c); printf("A variable of type double occupies %u bytes.\n", sizeof(double)); printf("Here are the addresses of some variables of type double:\n"); printf("The address of d is: %p The address of e is: %p\n", &d, &e); printf("The address of f is: %p\n", &f); system("pause"); return 0;}

    输出变量地址的格式

    %u用于显示sizeof生成的值(无符号整数),%p用于输出内存地址(十六进制表示)。


    输出数组变量地址

    以下程序将输出数组中所有变量的地址:

    #include 
    #include
    #include
    int main() { system("color 3E"); int arrays[10]; srand(time(NULL)); for (int i = 0; i < 10; i++) { arrays[i] = rand() % 20 + 1; } for (int i = 0; i < 10; i++) { printf("%d of the address -> %p\n", arrays[i], &arrays[i]); } printf("\n"); system("pause"); return 0;}

    "&数组名"的含义

    &arrays表示获取数组arrays的首地址,即数组第一个元素的地址。

    转载地址:http://exgfk.baihongyu.com/

    你可能感兴趣的文章
    MTTR、MTBF、MTTF的大白话理解
    查看>>
    mt_rand
    查看>>
    mysql -存储过程
    查看>>
    mysql /*! 50100 ... */ 条件编译
    查看>>
    mudbox卸载/完美解决安装失败/如何彻底卸载清除干净mudbox各种残留注册表和文件的方法...
    查看>>
    mysql 1264_关于mysql 出现 1264 Out of range value for column 错误的解决办法
    查看>>
    mysql 1593_Linux高可用(HA)之MySQL主从复制中出现1593错误码的低级错误
    查看>>
    mysql 5.6 修改端口_mysql5.6.24怎么修改端口号
    查看>>
    MySQL 8.0 恢复孤立文件每表ibd文件
    查看>>
    MySQL 8.0开始Group by不再排序
    查看>>
    mysql ansi nulls_SET ANSI_NULLS ON SET QUOTED_IDENTIFIER ON 什么意思
    查看>>
    multi swiper bug solution
    查看>>
    MySQL Binlog 日志监听与 Spring 集成实战
    查看>>
    MySQL binlog三种模式
    查看>>
    multi-angle cosine and sines
    查看>>
    Mysql Can't connect to MySQL server
    查看>>
    mysql case when 乱码_Mysql CASE WHEN 用法
    查看>>
    Multicast1
    查看>>
    mysql client library_MySQL数据库之zabbix3.x安装出现“configure: error: Not found mysqlclient library”的解决办法...
    查看>>
    MySQL Cluster 7.0.36 发布
    查看>>