C 语言实例 - 输出数组

C 语言教程 · 2019-02-20 23:43:28

使用 for 循环输出数组:

实例

#include <stdio.h> int main() { int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}; int loop; for(loop = 0; loop < 10; loop++) printf("%d ", array[loop]); return 0; }

输出结果为:

1 2 3 4 5 6 7 8 9 0

使用 for 循环逆向输出数组:

实例

#include <stdio.h> int main() { int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}; int loop; for(loop = 9; loop >= 0; loop--) printf("%d ", array[loop]); return 0; }

输出结果为:

0 9 8 7 6 5 4 3 2 1

点击查看所有 C 语言教程 文章: https://www.codercto.com/courses/l/17.html

查看所有标签

High Performance Python

High Performance Python

Micha Gorelick、Ian Ozsvald / O'Reilly Media / 2014-9-10 / USD 39.99

If you're an experienced Python programmer, High Performance Python will guide you through the various routes of code optimization. You'll learn how to use smarter algorithms and leverage peripheral t......一起来看看 《High Performance Python》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具