Q:

C Program to Increment every Element of the Array by one & Print Incremented Array

0

C Program to Increment every Element of the Array by one & Print Incremented Array

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#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]);   
 
    }
 
    void incrementArray(int arr[])
    {
 
        int i;
        for (i = 0; i < 4; i++)
            arr[i]++;     // this alters values in array in main()
 
    }

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now