如何在C中打印数组的最后一个元素 [英] How do I print the last element of an array in c

查看:961
本文介绍了如何在C中打印数组的最后一个元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检测C代码中整数数组的最后一个元素。
否则,当数组元素为空时,我需要停止处理数组数据。
实际上我的数组具有固定的最大大小,并且它是从外部文件填充的,因此我不知道它何时停止填充数组。

I want to detect the last element of an array of integer in C code. Otherwise i need to stop handling array data when the array element is empty. really my array have a maximum size fixed and it was filled from an external file so i dont know when it stop filling the array.

推荐答案

没有定义为空数组的术语

There is no defined term as empty array

即使您未显式初始化数组,您的数组也会始终保留一些值

Your array will always hold some value even if you dont initialize it explicitly

您需要在应用程序中定义其(数组元素)值为0还是其他某个值,如何将其定义为空

You need to define in your application how will you term it as empty may be by considering if its(element of array) value is 0 or some other value

这篇关于如何在C中打印数组的最后一个元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆