Unit3-C
Unit3-C
and Pointers in
Programming
A comprehensive guide to arrays, pointers, and their manipulation
techniques in programming.
Arrays: The Basics
Data Structure Fixed-Size Efficient
Sequential collection of elements Stores a fixed number of elements. Enables efficient data management
of same type. and manipulation.
Array Operations
1 Declaration 2 Initialization
Specify data type, name, Use curly braces: 'int
and size. Example: 'int numbers[3] = {1, 2, 3};'
numbers[10];'
3 Access
Use index to retrieve elements, starting at zero.
Manipulating Arrays
Adding Deleting
Insert new elements into Remove existing elements
the array. from the array.
Updating
Modify existing elements within the array.
Advanced Array Concepts
Two-Dimensional Arrays Multidimensional Arrays
Organized in rows and columns, like matrices. Arrays with more than two dimensions, used for
complex structures.
Introduction to Pointers
Address Of
Use the '&' operator to get the address of a variable.
Pointers in Function Calls
1 Call by Reference
Functions receive a reference to the variable, not a
copy.
2 Pointer Parameters
Changes to the data through the pointer affect the
original variable.
Advanced Pointer Concepts
Array of Pointers
1 Collection where each element points to different memory locations.
Pointers to Functions
2
Store the address of a function and call it indirectly.
Pointer to Pointer
3 Stores the address of another pointer, used for
complex structures.
Unraveling the World
of Strings
Explore the fundamental building blocks of text data structures.
Initializing Strings
Simple Assignment String Literals
Directly assign a string to a variable. Use quotes. Create strings with special characters or escape
sequences.
Accessing String Elements
1 Character Indexing 2 Slicing
Retrieve individual characters by their position. Extract substrings by specifying start and end
positions.
Arrays of Strings
Creation Iteration
Declare an array to hold Loop through the array and
multiple strings. process each string.
Manipulation
Modify, add, or remove elements from the array.
Built-in String Functions
Length Search
Get the number of characters in a string. Find a substring within a string.
1 2 3 4
Uppercase/Lowercase Replace
Convert strings to uppercase or lowercase. Substitute a part of a string with another string.
Passing Strings to
Functions
Splitting
Divide a string into an array of substrings.
Formatting
Control the layout and appearance of strings.