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

📄 ex09_07.c

📁 c21Examples.rar
💻 C
字号:
#include <stdio.h>

#define MAX1 5
#define MAX2 8

int array1[MAX1] = { 1, 2, 3, 4, 5 };
int array2[MAX2] = { 1, 2, 3, 4, 5, 6, 7, 8 };
int total;

int sumarrays(int x1[], int len_x1, int x2[], int len_x2);

int main( void )
{
   total = sumarrays(array1, MAX1, array2, MAX2);
   printf("The total is %d\n", total);

   return 0;
}

int sumarrays(int x1[], int len_x1, int x2[], int len_x2)
{

   int total = 0, count = 0;

   for (count = 0; count < len_x1; count++)
      total += x1[count];

   for (count = 0; count < len_x2; count++)
      total += x2[count];

   return total;
}

⌨️ 快捷键说明

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