0% found this document useful (0 votes)
17 views10 pages

Arrays in C

The document provides an overview of arrays in C programming, explaining their definition, benefits, and how to declare and initialize them. It covers accessing elements, types of arrays, common operations like insertion and deletion, and how to pass arrays to functions. The conclusion emphasizes the efficiency of arrays for managing multiple values and includes a code example.

Uploaded by

1974suparnapaul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views10 pages

Arrays in C

The document provides an overview of arrays in C programming, explaining their definition, benefits, and how to declare and initialize them. It covers accessing elements, types of arrays, common operations like insertion and deletion, and how to pass arrays to functions. The conclusion emphasizes the efficiency of arrays for managing multiple values and includes a code example.

Uploaded by

1974suparnapaul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

B.

P PODDAR INSTITUTE OF MANAGEMENT


AND TECHNOLOGY

TOPIC : ARRAYS IN C PROGRAMMING

SEM: 2ND YEAR:1ST

NAMES UNIVERSITY
ROLL NO.
Arrays in C
UNDERSTANDING ARRAYS IN C PROGRAMMING
Introduction to Arrays

 • An array is a collection of variables of the


same data type.
 • Stored in contiguous memory locations.
 • Accessed using an index.
Why Use Arrays?

 • Efficient storage of multiple values.


 • Reduces redundancy in variable declarations.
 • Provides easy access and manipulation of
data.
Declaring and Initializing
Arrays
 Syntax:
 int arr[5]; // Declaration
 int arr[5] = {1, 2, 3, 4, 5}; // Initialization
Accessing Array
Elements
 • Elements are accessed using index numbers.
 • Example: arr[2] returns the 3rd element.
 • Indexing starts from 0 in C.
Types of Arrays (1D &
2D)
 • One-Dimensional Arrays: int arr[5];
 • Two-Dimensional Arrays: int arr[3][3];
 • Multi-dimensional arrays exist but are less
common.
Array Operations

 • Insertion: Adding elements at specific


positions.
 • Deletion: Removing elements.
 • Searching: Finding elements.
 • Sorting: Arranging elements.
Passing Arrays to
Functions
 • Arrays are passed by reference.
 • Example:
 void display(int arr[], int size) {
 for(int i=0; i<size; i++) {
 printf("%d ", arr[i]);
 }
 }
Conclusion and Example
Code
 • Arrays store multiple values efficiently.
 • Used for structured data management.
 • Example:
 int arr[] = {10, 20, 30};
 printf("%d", arr[1]); // Output: 20

You might also like