Difference Between An Array And Address of the Array In C OR Cpp Programming
Vložit
- čas přidán 28. 08. 2024
- JOIN ME
-----
CZcams 🎬 / @cppnuts
Patreon 🚀 / cppnuts
COMPLETE PLAYLIST
------------
C++ Tutorial For Beginners: • Introduction To C++
STL (Standard Template Library): • STL In C++
ThreadIng In C++: • Multithreading In C++
Data Structures: • Data Structure
Algorithms: • Binary Search
Design Patterns: • Factory Design Pattern...
Smart Pointers: • Smart Pointer In C++
C++14: • Digit Separator In C++
C++17: • std string_view in C++...
C++ All Type Casts: • static_cast In C++
INTERVIEW PLAYLIST
------------
C++ Interview Q&A: • Structural Padding & P...
C++ Interview Q&A For Experienced: • How delete[] Knows How...
Linked List Interview Questions: • Find Kth Node From Bac...
BST Interview Questions: • Search Element In Bina...
Array Interview Questions: • Reverse An Array
String Interview Questions: • Check String Is Palind...
Bit Manipulation Questions: • Find Set Bit In Intege...
Binary Tree Interview Question: • Invert Binary Tree
Sorting Algorithms: • Bubble Sort
C++ MCQ: • Video
C MCQ: • What printf returns af...
C Interview Questions: • Designated Initializat...
QUICK SHORT VIDEOS
-------------
C++ Short : • C++ Short Videos
C Short : • Shorts C Programming MCQ
In this video we will learn what is the difference between array and address of the array.
Iet's suppose there is an array of type integer and if printed like :
printf("%p", array);
printf("%p", &array);
What would be the difference, as the result would be same, so the crux of the video is to know that the type of array and &array is different even though we see the same address is printed.
#cppprogramming #programming #cprogramming
Thanks roopesh
Awesome as always 🎉
Thanks..
@@CppNuts 🌷🌷🌷
This was interesting. I learnt something new today. Thanks cpp nuts...
Glad to hear that..
Shouldn't the value of &array+1 be "0x16f1c3228" instead of "0x16f1c3218" ? As the array size is 20 bytes and the starting address is 0x16f1c3204, so the complete array would take "0x16f1c3204" to "0x16f1c3224" and then incrementing 1 byte would give us 0x16f1c3228. Please correct me if I have understood it incorrectly.
The syntax gets confusing with multi-dimensional arrays, especially when using new[] and delete[]. Hope you get around to explaining this! I am always forgetting, then having to relearn whenever I have to use it again.
In c++ I usually just use nested std::array or std::vector as it's less confusing and error prone. But to understand how the containers are implemented its nice to know how low-level arrays work. It's also useful wherever you need speed optimization in certain parts of your code.
Yes std::array and std::vectors are mostly used these days.
Good tutorial :)