⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ptr_math.c

📁 里面包含很多c语言的源码
💻 C
字号:
/* Demonstrates using pointer arithmetic to access */
/* array elements with pointer notation. */

#include <stdio.h>
#define MAX 10

/* Declare and initialize an integer array. */

int i_array[MAX] = { 0,1,2,3,4,5,6,7,8,9 };

/* Declare a pointer to int and an int variable. */

int *i_ptr, count;

/* Declare and initialize a float array. */

float f_array[MAX] = { .0, .1, .2, .3, .4, .5, .6, .7, .8, .9 };

/* Declare a pointer to float. */

float *f_ptr;

int main( void )
{
    /* Initialize the pointers. */

    i_ptr = i_array;
    f_ptr = f_array;

    /* Print the array elements. */

    for (count = 0; count < MAX; count++)
        printf("%d\t%f\n", *i_ptr++, *f_ptr++);

    return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -