📄 ptr3.c
字号:
/*-*//******************************************************** * Program: Array initialization * * * * Purpose: Show how to initialize an array. * * * * Usage: Run the program and look at the results. * * * * Note: Same as the previous program but uses * * pointer arithmetic instead of array indices. * ********************************************************//*+*/#include <stdio.h>int array[] = {4, 5, 8, 9, 8, 1, 0, 1, 9, 3};int *array_ptr;int main(){ array_ptr = array; while ((*array_ptr) != 0) ++array_ptr; printf("Number of elements before zero %d\n", array_ptr - array); return (0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -