博客
关于我
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/

    你可能感兴趣的文章
    Metasploit Web服务器渗透测试实战
    查看>>
    MFC模态对话框和非模态对话框
    查看>>
    Moment.js常见用法总结
    查看>>
    MongoDB出现Error parsing command line: unrecognised option ‘--fork‘ 的解决方法
    查看>>
    mxGraph改变图形大小重置overlay位置
    查看>>
    MongoDB可视化客户端管理工具之NoSQLbooster4mongo
    查看>>
    Mongodb学习总结(1)——常用NoSql数据库比较
    查看>>
    MongoDB学习笔记(8)--索引及优化索引
    查看>>
    mongodb定时备份数据库
    查看>>
    mppt算法详解-ChatGPT4o作答
    查看>>
    mpvue的使用(一)必要的开发环境
    查看>>
    MQ 重复消费如何解决?
    查看>>
    mqtt broker服务端
    查看>>
    MQTT 保留消息
    查看>>
    MQTT 持久会话与 Clean Session 详解
    查看>>
    MQTT工作笔记0007---剩余长度
    查看>>
    MQTT工作笔记0009---订阅主题和订阅确认
    查看>>
    Mqtt搭建代理服务器进行通信-浅析
    查看>>
    MS Edge浏览器“STATUS_INVALID_IMAGE_HASH“兼容性问题
    查看>>
    ms sql server 2008 sp2更新异常
    查看>>