Answers:
7 of type array are in C program
1. Declaring Arrays,
2. Passing Arrays to Functions
3. Arrays\x07 Pointers\x07 Pointer Arithmetic
4. String Assignment and I/O
5. Array Initializes
6. Arrays for Databases
7. Common Errors
1. Declaring Arrays,
2. Passing Arrays to Functions
3. Arrays\x07 Pointers\x07 Pointer Arithmetic
4. String Assignment and I/O
5. Array Initializes
6. Arrays for Databases
7. Common Errors
There are two types of array in c programming
1.single dimensional array
2. multidimensional array
#include <stdio.h>
int main()
{
int arr[100], n, i;
int diff;
// Input the number of elements
printf("Enter the number of elements: ");
scanf("%d", &n);
// Input array elements
printf("Enter %d elements:\n", n);
for(i = 0; i < n; i++)
{
scanf("%d", &arr[i]);
}
// Initialize difference with the first element
diff = arr[0];
// Subtract remaining elements
for(i = 1; i < n; i++)
{
diff = diff - arr[i];
}
// Display the result
printf("Difference of array elements = %d\n", diff);
return 0;
}

Login to add comment