Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void sum(int array1[], int array2[], int array3[], int size);
- int main(void){
- const int SIZE=4;
- int array1[]={2,4,5,8};
- int array2[]={1,0,4,6};
- int array3[SIZE];
- int x;
- sum(array1, array2, array3, SIZE);
- for (x=0; x<SIZE; x++){
- printf("%4d", array3[x]);
- }
- printf("\n");
- return 0;
- }
- void sum(int array1[], int array2[], int array3[], int size){
- int i;
- int *ptr1, *ptr2, *ptr3;
- ptr1=array1;
- ptr2=array2;
- ptr3=array3;
- for(i=0; i<size; i++){
- *ptr3=*ptr1+*ptr2;
- ptr1++;
- ptr2++;
- ptr3++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement