0:50 A shorter way would be to just get rid of the ampersand and [0]. When an array name is used in an expression, the array is automatically cast to a pointer to the first element of the array. So one could also write: int *p = a;
WOW!! Literally, best programming intro and C explanation I've seen so far the series is Amazing!! ❤ and the explanation is very simple😊 Please post daily content👌 I came here for the "Data Structure intro" but found the explanation worth to review the basics of programming all over again. I'm sure the other playlists are as good as this one. Thank you so much!!😊 Please post from the Data Structure part on your road map 🙏 >>Data Structures: 1) Stacks 2) Queues 3) Linked list 4) Trees 5) Binary search trees 6) Binary heaps 7) Graphs 8) Tree traversals
I have taken course on udemy in c programming.. but after some days I have seen this channel on RUclips .. and I have a thought about wasting my money on udemy... ❤️❤️❤️... Thank u so much sir..
Initially I thought that the pointer concept is very complex. But after watching videos of NESO academy about the pointers,I have started to understand the concept. Thanks for the instructor for making me understand the complex concept in an efficient way.
Wish i could see you and give you a hug, like right now! I have been trying to understand this pointer of a thing for more that three days, but here comes NESO ACADEMY which such a lucid explanation. Thank you very much! You've made my day.
No need to multiply by 4 in case of int array. See this example int size = 4; int arr[] = {1, 2, 3, 4}; int* p = &arr; *(p + 1) = 9; for (int i = 0; i < size; i++) { printf("%d ", arr[i]); } It should print: 1 9 3 4
I never commented on anyone youtube channel but neso how can i thank you i am understanding everything(apart from recursion) and now i think i can pass my exam
Answer of the question: After the operation "p = p + 2", the pointer p will now point to the memory address that is 2 elements ahead of its current location. Since the initial value of p is the address of the 3rd element of the array i.e &a[2], after the operation p = p + 2, the pointer p will point to the 5th element of the array i.e p = &a[4]. Therefore, the index of the array after this operation is 4.
Thank you so much for these amazing videos. I understood really well what are pointers and literally I understand each point you explain. The best teacher ever for programming. Whoever I meet with doubts in C I will recommend Neso academy for sure
ans is 4. sir i am 1st year student in iiit gwalior in IT stream. my programming language was going extremly wrost but neso academy saved my engineering life .i saw many youtube channel related to programming language but this one is extremly good. i gain more dept interest in programming because of you. so thank you very much sir for creating such kind of channel which helps all students . 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏thank you very much sir 🙏🙏🙏🙏🙏🙏
The video explains pointer arithmetic, specifically how adding an integer to a pointer moves the pointer forward by that many positions in the array. It provides examples and explains the underlying memory layout. Key moments: 00:00 Understanding pointer arithmetic is crucial in programming. Adding an integer to a pointer moves it to the next memory location, not just by the integer value, due to memory allocation. -Pointer arithmetic involves moving pointers to different memory locations based on integer additions. -Explaining the concept of adding an integer to a pointer using a practical example with array indexing. -Detailing the memory allocation and the impact of adding an integer to a pointer on memory addresses.
If we want a[2+2] a[4] we have to multiply p=p+2*4 if we assume that the data stored is an integer.... and if we assume that the value of the integer a[2] is in 1002 to go to a[4] we have to add 4 and add 4 again 2*4
The answer to the h.w qn is 4 as first the pointer pointed to the index 2 and p=p+2 moves 2 positions to the right, and so now the pointer will point to index 4,i.e,p=&a[4]
HOMEWORK QUESTION we will get index 4 i.e.a[4] --(EXPLANATION)------->>>>>suppose we take &a[2]=1000, so according to question (p) is equal to 1000 and if we perform p=p+2*4 as earlier explained in the current video , we will get p=1008 and each element of array ocupy 4 bytes of memory , so definetly after reaching from address 1000 to 1008 we have moved two index value forward means from a[2] to a[4], means from index 2 to index 4. So final ans is we have reached a[4]. hope you all understand :) .
@@devsutong bro simply we can say it is the formula to perform such things and practically if we do this question on compiler same output we get so we can say that we have understood which formula compiler use to perform such functions .
p=&a[2]------->address of array 1008--------->elements position is 3rd in array; =>p=p+2=p+2*4=1008+8=1016; -------->which location is address of array a[4](1016)---->elements position is 5th in array.....
Lets consider the base address is 1000 and currently the pointer is at 3rd element which means 1000+4+4=1008 is equal to & a[2] and we have to add 2 to it p=p+2 means 1008+2*4=1016 Which is nothing but & a[4] so this is the Answer...
I'm looking that so many comments are a[4]. But p=&a[2] which means the base value of a[2]. When we write p=p+2, then base value will added with 2. and the output of p will be a base value only. Not a value like a[3],a[4] etc.
Initially p has address of a[2]... And p=p+2 means two shift towards right from initial address.. So now.. P will have a[4].
and uh also write as P will have 4[a].
[4]
@@modapothularajasekhar4645&[øk]
yeah
0:50 A shorter way would be to just get rid of the ampersand and [0]. When an array name is used in an expression, the array is automatically cast to a pointer to the first element of the array.
So one could also write:
int *p = a;
exactly
he's teaching it systematically. mentioning that shortcut will cause confusion to beginners
Yes, isn't this the reason why we don't use & in scanf for strings?
@@techmad8204 yeah man
@@techmad8204can you tell me which resources are you using to learn c
Your videos have honestly made a HUGE difference in my academic career.
i thank you from the bottom of my heart for putting in the effort and time.
Base Address= 1000 ,
p= &a[2] = 1008 ,
p= p+2 = 1008+2*4 = 1016 ,
p= a[4]
Awesome
p = a[4] which is the fifth element of array
WOW!! Literally, best programming intro and C explanation I've seen so far the series is Amazing!! ❤ and the explanation is very simple😊 Please post daily content👌
I came here for the "Data Structure intro" but found the explanation worth to review the basics of programming all over again. I'm sure the other playlists are as good as this one.
Thank you so much!!😊 Please post from the Data Structure part on your road map 🙏
>>Data Structures:
1) Stacks
2) Queues
3) Linked list
4) Trees
5) Binary search trees
6) Binary heaps
7) Graphs
8) Tree traversals
The answer is : the pointer will point to : a[4]
How
@@bhargavskulkarni2855it moves the pointer 2 index forward.
Thats the fifth index
Which we write a[4] Because counting begins from 0
I have taken course on udemy in c programming.. but after some days I have seen this channel on RUclips .. and I have a thought about wasting my money on udemy... ❤️❤️❤️... Thank u so much sir..
Initially I thought that the pointer concept is very complex. But after watching videos of NESO academy about the pointers,I have started to understand the concept. Thanks for the instructor for making me understand the complex concept in an efficient way.
This is the most amazing C tutorial. ❤️ Very good job, I can't wait for the playlist to be finished.
This series has made me attempt C programs I found difficult.
I can't thank you enough sir. Better late than never. I'm glad I saw this academy
Wish i could see you and give you a hug, like right now!
I have been trying to understand this pointer of a thing for more that three days, but here comes NESO ACADEMY which such a lucid explanation. Thank you very much! You've made my day.
No need to multiply by 4 in case of int array. See this example
int size = 4;
int arr[] = {1, 2, 3, 4};
int* p = &arr;
*(p + 1) = 9;
for (int i = 0; i < size; i++) {
printf("%d
", arr[i]);
}
It should print:
1
9
3
4
I tried various platforms to learn c but the quality of explanation that u give is next level
I never commented on anyone youtube channel but neso how can i thank you i am understanding everything(apart from recursion) and now i think i can pass my exam
Taking care of me in signals, controls, and now during an internship. Great work!
a[4], 5th element of the array
Answer of the question:
After the operation "p = p + 2", the pointer p will now point to the memory address that is 2 elements ahead of its current location.
Since the initial value of p is the address of the 3rd element of the array i.e &a[2], after the operation p = p + 2, the pointer p will point to the 5th element of the array i.e p = &a[4].
Therefore, the index of the array after this operation is 4.
It is realy a good explination for me
apart from the class and coaching section. Thank you sir
i can't express my happiness to find a great lecturer like u
i am veryveryvery very happpy
You are the best teacher for C programming
6:38 a[2+2]= a[4]
ANS- index will be 4....Sir thank you so much for teaching and sharing such amazing knowledge of C with us!!
Thank you so much sir.
Best explanation on complete RUclips.
I didn't understand the any programming language in the,but here I am learning it with the interest.
And is a[4]..as p=p+2 simply means shifting the pointer by 2 units from the initial position in forward direction..ie.from a[2] to a[4]..
If only if this video exists back in 2017, I would have excelled my programming paper. Thanks for the great content.
@jw72jswu728uwj You don't know his circumstances. Maybe he dropped and coming back at it again. Mind your own business.
Thank you so much for these amazing videos. I understood really well what are pointers and literally I understand each point you explain. The best teacher ever for programming. Whoever I meet with doubts in C I will recommend Neso academy for sure
Index will be 5 bz pointer contains third address of array and we 2 in this so pointer will move 2 position in forward direction
ans is 4. sir i am 1st year student in iiit gwalior in IT stream. my programming language was going extremly wrost but neso academy saved my engineering life .i saw many youtube channel related to programming language but this one is extremly good. i gain more dept interest in programming because of you. so thank you very much sir for creating such kind of channel which helps all students . 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏thank you very much sir 🙏🙏🙏🙏🙏🙏
primary address is p is array of 3rd element i.e p=&a[2],when we add p=p+2 then new address i.e p=&a[2+2]=&a[4].which refer 5th element.
'P' will point the &a[4] of the array, that means i will point he 5th element of thee array.
The video explains pointer arithmetic, specifically how adding an integer to a pointer moves the pointer forward by that many positions in the array. It provides examples and explains the underlying memory layout.
Key moments:
00:00 Understanding pointer arithmetic is crucial in programming. Adding an integer to a pointer moves it to the next memory location, not just by the integer value, due to memory allocation.
-Pointer arithmetic involves moving pointers to different memory locations based on integer additions.
-Explaining the concept of adding an integer to a pointer using a practical example with array indexing.
-Detailing the memory allocation and the impact of adding an integer to a pointer on memory addresses.
It will be a[4].... And sir you are amazing..... I m literally getting to understand C learning from u....
If we want a[2+2] a[4] we have to multiply p=p+2*4 if we assume that the data stored is an integer.... and if we assume that the value of the integer a[2] is in 1002 to go to a[4] we have to add 4 and add 4 again 2*4
The answer to the h.w qn is 4 as first the pointer pointed to the index 2 and p=p+2 moves 2 positions to the right, and so now the pointer will point to index 4,i.e,p=&a[4]
Index will be the p[4] which is actually the fifth element of the array.
H.W problem :
p = &a[2] ;
p = &a[2] + 2 ; ❌
p = &a[2 + 2] = &a[4] ; ✔️
the answer :-a[4];
Excellent Teaching
I get clear about pointers
👏👏👏👏👏👏👏
HOMEWORK QUESTION
we will get index 4 i.e.a[4] --(EXPLANATION)------->>>>>suppose we take &a[2]=1000, so according to question (p) is equal to 1000 and if we perform p=p+2*4 as earlier explained in the current video , we will get p=1008 and each element of array ocupy 4 bytes of memory , so definetly after reaching from address 1000 to 1008 we have moved two index value forward means from a[2] to a[4], means from index 2 to index 4. So final ans is we have reached a[4]. hope you all understand :) .
why did the instructor says that we should multiply by 2 by 4 in 5:40
@@devsutong bro simply we can say it is the formula to perform such things and practically if we do this question on compiler same output we get so we can say that we have understood which formula compiler use to perform such functions .
@@shivamrawat4289 ok now i understand, good explanation by the instructor but his English is very misleading
The explanation is like butter
Nice explanation sir ❤️ really amazing .Thank You
Initially p has address of a[2].
And "p=p+2" means two shift forward from initial address.
So now - P will have a[4].
because 2+2=4.
As p contains the address location of a[2]
p + 2 will be a[4] ie the fourth index of a
p=&a[2]------->address of array 1008--------->elements position is 3rd in array;
=>p=p+2=p+2*4=1008+8=1016;
-------->which location is address of array a[4](1016)---->elements position is 5th in array.....
Index of array will be 5
Pointer will point to a[4]
Initial index value of p=2 and after adding 2 it will become p=4
Lets consider the base address is 1000 and currently the pointer is at 3rd element which means 1000+4+4=1008 is equal to & a[2] and we have to add 2 to it p=p+2 means 1008+2*4=1016 Which is nothing but & a[4] so this is the Answer...
please add more topics! i love your explanation style!!
The answer is a[4] that is the fifth element of the array;//
I'm looking that so many comments are a[4]. But p=&a[2] which means the base value of a[2]. When we write p=p+2, then base value will added with 2. and the output of p will be a base value only. Not a value like a[3],a[4] etc.
your totally correct bro.
my brain was rotting reading the comment sectiom
So the index of the array after this operation is p=a[4]. Sir please let us know whether it js the right answer or not?
right
this was so clear! thank you for this
Abee
pointer p will have address of p[4] hence point to p[4].
Best explanation ever
P points to the array a[4]
And index will be 5
answer to homework question: it will point to a[4].. that means, 5th element in the array
The index of the array pointed by the pointer p will be a[4]
Fried my brain. Good night.
Sir ans is
Base add a[0]+2*4
And
Index 2
Index = a[4]
after p = p + 2
Thanks for such great explanation ....
6:49 ans is 4
Initially p have &a [2] and after p=p+2 address will be shift two index right so ans is &a [4]
Amazing explanation.
here a[2] means third element so p+2 wil shift the pointer to the fifth element so the final answer will be p=&a[[4]
saying p = &a[2] and after the operation p = p + 2 the answer will be p = &a[2 + 2] === p = &a[4]
4th index or 5th element 4B base address then 1016
answer p will point to the fourth elements so p=&a[4]
You are Doing a great work❤️❤️
P=&a [2] at 5th element of array
Answer is: a[4]
I think the answer is p=[a4]...Because pointer shifts 2 places in the right direction.
p=p+2 -> &array[2]
Century complete now second century on. Can we say 6:00 p+3*4=Base address+next Element*total byte of that element.
pointer will point index 4 i,e 5th element of an array
Thank You Soo Much
If initial address is 1000 then 1016 is the location that pointer points to.
Answer is p = &a[4]
i strongly suggest putting the speed at 0.75x it's so much easier to understand
Programming language is very good and practice with me and improve skills thinku you so much your practice white
Answer for homework problem:the pointer will point to index a[4] after performing..p=p+2
6.26 answer is a[4]
INDEX WILL BE : a[4]
Thank you for this wonderful job. 😀
ANS= a[4]
of course - a[4]
The index is 4.. And the memory location is 1016.... (Say 0 index has 1000 memory location)
index after operation will be -: 4.
The index of the array will be a[4].
The answer is: it points to the element of index 4.
a[4] i.e 5th element !
The index will be at the 5th elements of the array.
The answer is a[4]. I love these videos a lot, they are quite explanatory. Thank you.
it'll be the fifth element of the array , a[4]
a[4],5th element of an array.
please make a videos in sorting techniques and some more programs on patterns it is important they test us logical knowledge
Pointer will point to a[4]
the answer is &a[4] and the pointer is in fifth position
4th index @5th element