GridVids
Sign in with YouTube

C Programming tutorial #15 Arrays and Pointers | Pointer arithmetic

Mark watched
Don't Miss
Hide
Open in popup Open on YouTube

Xoviabcs 8 years ago
Chapters

C Programming tutorial #15 Arrays and Pointers | Pointer arithmetic This C Programming lecture covers the following topics:

ptr++ and ++ptr: ++ptr and ptr++ are both equivalent to ptr + 1 - though they are “incremented” at different times

Pointer Arithmetic: Valid pointer operations: - Assignment between pointers of the same type - Addition/ subtraction between a pointer and an integer - Comparison between two pointers that point to elements of the same array - Subtraction between two pointers that point to elements of the same array - Assignment or comparison with zero (NULL)

Pointer Arithmetic – Increment/Decrement: Increment/decrement: if p is a pointer to type T, p++ increases the value of p by sizeof(T) (sizeof(T) is the amount of storage needed for an object of type T). Similarly, p-- decreases p by sizeof(T);

Add/Subtract Integers from Pointers: Addition/subtraction with an integer: if p is a pointer to type T and n an integer, p+n increases the value of p by n*sizeof(T). - Similarly, p-n decreases p by n*sizeof(T);

Comparing Pointers: Any pointer can be meaningfully compared for equality or inequality with zero.

C Programming Tutorial/ Lectures/ Course with Data Structures & Algorithms @ https://goo.gl/K6VbgL Machine Learning Complete Tutorial/Lectures/Course from IIT (nptel) for GATE @ https://goo.gl/AurRXm Discrete Mathematics for Computer Science for GATE @ https://goo.gl/YJnA4B (IIT Lectures for GATE) Best Programming Courses @ https://goo.gl/MVVDXR Operating Systems Lecture/Tutorials from IIT for GATE CSE @ https://goo.gl/GMr3if MATLAB Tutorials for GATE @ https://goo.gl/EiPgCF