Arrays in C programming

An array is a group (or collection) of same data types. For example an int array holds the elements of int types while a float array holds the elements of float types. How to declare Array in C int num[35];  /* An integer array of 35 elements */ char ch[10];  /* An array of characters … Read more

Two Dimensional Array

Two dimensional arrays are also called table or matrix, two dimensional arrays have two subscripts Two dimensional array in which elements are stored column by column is called as column major matrix Two dimensional array in which elements are stored row by row is called as row major matrix First subscript denotes number of rows … Read more

C Program to find largest element of an Array

#include <stdio.h> largest_element(int arr[], int num) { int i, max_element; max_element = arr[0]; for (i = 1; i < num; i++) if (arr[i] > max_element) max_element = arr[i]; return max_element; } int main() { int arr[] = {1, 24, 145, 20, 8, -101, 300}; int n = sizeof(arr)/sizeof(arr[0]); printf(“Largest element of array is %d”, largest_element(arr, … Read more