在C语言中,可以使用for循环对样本进行遍历,以下是一个示例:
#include <stdio.h>int main() { int samples[] = {1, 2, 3, 4, 5}; int length = sizeof(samples) / sizeof(samples[0]); // 使用for循环遍历数组 for (int i = 0; i < length; i++) { printf("%d\n", samples[i]); } return 0;}上述代码定义了一个整型数组samples,然后通过计算数组长度的方式获取数组的长度length。接着使用for循环遍历数组,通过i从0递增到数组长度-1的方式,获取数组中的每个元素,并打印出来。
运行上述代码,输出结果为:
12345这样就完成了对样本的遍历。

