You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
500 B
C

/*
* C Program to Increment every Element of the Array by one & Print Incremented Array
*/
#include <stdio.h>
void incrementArray(int[]);
void main()
{
int i;
int array[4] = {10, 20, 30, 40};
incrementArray(array);
for (i = 0; i < 4; i++)
printf("%d\t", array[i]); // Prints 2, 3, 4, 5
}
void incrementArray(int arr[])
{
int i;
for (i = 0; i < 4; i++)
arr[i]++; // this alters values in array in main()
}
/*
11 21 31