can't express my thanks through words.i am a beginner in the programming field and u r guiding me to a strong base. u r a gem sir.lots of love and respect for helping ordinary students like me.
In the first question you have explained that we cannot write int *p = &i; but in the third question where we are printing the address of pointer, you have used the same thung
Many beginners like myself, struggle with pointers, when the star symbol have different meanings. After a while I differentiate between making a pointers or the contents of pointers. It helps to have a good understanding hexadecimals and their relations to bytes and bits. And lastly use a debugger and single step through the code while monitoring the related memory.
THANKS A LOT!!! I am facing difficulties in the whole topic of pointers but now I have gained more refined concepts because of your such simple and great explanation. GOD BLESS YOU!
I loved the way you explain every topic.Now I realize ,I haven't learned well in 1st yr .I wish I could found your videos in 1st yr anyways now I follow ur channel n I got to learn new things.thanks to you.keep up doing this.
I believe a small point needs to be raised for part (d) of question 4. You have made the assumption that the variable i is an integer, although this was never mention in the question. If the value stored in i was a hexadecimal value which could correspond to an address in memory wouldn't *i be a valid expression? And if this value corresponded to the address of i, then *i would evaluate to itself, therefore would be a valid alias. Therefore the answer to part (d) needs to be, if i does not hold a hexadecimal value of its own address, then it's not an alias for i. We need more information to confirm if it is an alias.
but it is mentioned that i is a variable and p is a pointer. even if i stores a hexadecimal value it doesn't mean that it's an address. *i will point to a different value stored at position pointed by the value of i which won't be equal to i.
Tq for ur fantastic explanation sir. Before seeing this video I confused about pointers. But after your fantastic explanation I understood clearly especially with the last example of the video
Q2. but still constant is changeable! #include int fun(int *p){ //didn’t use const *p = 10; } int main(){ const int x= 8; fun(&x); printf("%d ",x); } //output 10
in question 3 you print the address of a pointer because you wrote 'p' in printf function. for print the address of a variable we write *p or 'i' in printf function insteed of p....... if i am wrong please comment down.....and i am right give a thumbsup👍
For question number 1, it'll be easier to answer if we had a habit of adding the * to the datatype rather than the variable names. For ex: int* p instead of int *p. Or int* fun() instead of int *fun(). Int *p just adds to more confusion for no real reason. The compiler is going to compile both expressions the same way. Writing it as int *p when the same thing when reading out loud is "pointer to int-p" is just plain stupid. One of the reasons why pointers is very confusing for beginners.
There is a slight mistake or idk what that is! *&p and &*p always prints the address of I. According to normal logic , *&p should print the garbage inside p and &*p should print the address of p! Then why it always prints the address of the pointer "p"? I love your classes by the way sir ! 😁
int num = 69; printf("%d ",&num); int *ptr = # *ptr = # printf("%d",num); this definitely works, hence last 2 statements at 2:51 are wrong!!!!!
It is correct... Because it indicates to the compiler that p is not a simple variable rather than it's a pointer which points to a integer type data... But after declaring a pointer, if we again put a * in front of it this will indicate to the value Stored in the particular address which is stored in the pointer, ie, it will indicate to the integer not to the address of it
www.onlinegdb.com/online_c_compiler he is correct man, stop misguiding people p.s. you can change it but you have to use non constant pointer to do this.
Creative Minds nope u cant directly do this because i is a not pointer but u can give a constant memory adress by your own by doing İnt *p; P= 3000; Now p points the memory adress 3000
can't express my thanks through words.i am a beginner in the programming field and u r guiding me to a strong base. u r a gem sir.lots of love and respect for helping ordinary students like me.
I actually never saw anyone able to explain pointers that well and I´ve been trying to understand pointers via RUclips for two days !
Ty man !
In the first question you have explained that we cannot write int *p = &i; but in the third question where we are printing the address of pointer, you have used the same thung
Many beginners like myself, struggle with pointers, when the star symbol have different meanings.
After a while I differentiate between making a pointers or the contents of pointers.
It helps to have a good understanding hexadecimals and their relations to bytes and bits.
And lastly use a debugger and single step through the code while monitoring the related memory.
THANKS A LOT!!! I am facing difficulties in the whole topic of pointers but now I have gained more refined concepts because of your such simple and great explanation. GOD BLESS YOU!
I loved the way you explain every topic.Now I realize ,I haven't learned well in 1st yr .I wish I could found your videos in 1st yr anyways now I follow ur channel n I got to learn new things.thanks to you.keep up doing this.
special thanks to the last question. It cleared my very basic doubt of pointer.
of course
you you also from CS Branch?
I'm studying in IIIT Gwalior with CS.
@@harshitagarwal8022 what's do you think...if you tell here college name then she will be impressed by you... you are the true IITian😄😄😄
@@rahulsharma2572 IIITian bro 😂😂😂😂
😂🤣🤣Impress tou ho jaayegi...
i just want to add this this is an incredibly helpful video. you have my infinite thanks for making this amazing series!
I believe a small point needs to be raised for part (d) of question 4.
You have made the assumption that the variable i is an integer, although this was never mention in the question. If the value stored in i was a hexadecimal value which could correspond to an address in memory wouldn't *i be a valid expression? And if this value corresponded to the address of i, then *i would evaluate to itself, therefore would be a valid alias.
Therefore the answer to part (d) needs to be, if i does not hold a hexadecimal value of its own address, then it's not an alias for i. We need more information to confirm if it is an alias.
but it is mentioned that i is a variable and p is a pointer. even if i stores a hexadecimal value it doesn't mean that it's an address. *i will point to a different value stored at position pointed by the value of i which won't be equal to i.
Tq for ur fantastic explanation sir. Before seeing this video I confused about pointers.
But after your fantastic explanation I understood clearly especially with the last example of the video
The most understandable video about basis of pointers I've ever seen. Thank you so much
THIS IS THE BEST C COURSE EVER. I AM LITERALLY IMPRESSED.
Thank you very much Neso Academy.I have learned a lot of important things that miss by my eyes.
Finally difference between pointers and indifference operators is get cleared in QNA session, thank you🙌
the first question really solved one of my long time questions, context !!. Thanks boys
Q2. but still constant is changeable!
#include
int fun(int *p){ //didn’t use const
*p = 10;
}
int main(){
const int x= 8;
fun(&x);
printf("%d ",x);
}
//output 10
Type casting from const to non-const? Confusing C.
Wow! This tutorial just so helpful for me to understand more about pointer. Thanks a lot!
Oh wow! A lot of things about the nature of pointers just made A LOT of sense with these questions!
Really Nice explaination...please come with more such C series
Your series of c programming is very helpful.Thanks for making such videos.
I had the first question exactly. Thank you so much. These tutos are so satisfying.
in question 3 you print the address of a pointer because you wrote 'p' in printf function.
for print the address of a variable we write *p or 'i' in printf function insteed of p.......
if i am wrong please comment down.....and i am right give a thumbsup👍
Came from CS50. Personally, I WAY prefer your explanation over theirs. Wonderful job. Thank you for the knowledge
You are God, what a level of explanation , and in depth.
i am very confused about pointer,especially the first question.And you save my life!!! Thank you
Pointers is one of the difficult topics in programming, but after watching this vid, I got to use pointers, thanks
Best Chanel for c,pro💯💯💯✔️
Waited for that first question!!
God gifted lectures🔥🔥
But sir in previous video you tell
Int x=5,*ptr=&x
Very helpful thank you
Man u deserve a million 💪!
You’re the best instructor on YT I’ve seen so far ❤
Please explain near pointer, far pointer and huge pointer in C language
when you use %p to see address of variable you wıll see the result whıch ıs hexadecımal,to see decımal you should %d as usual.
thankuuuu
@@alvinaug3844 np
For question number 1, it'll be easier to answer if we had a habit of adding the * to the datatype rather than the variable names. For ex: int* p instead of int *p.
Or int* fun() instead of int *fun(). Int *p just adds to more confusion for no real reason. The compiler is going to compile both expressions the same way. Writing it as int *p when the same thing when reading out loud is "pointer to int-p" is just plain stupid. One of the reasons why pointers is very confusing for beginners.
Very good point!
Thanks for this great knowledgeable information
You are the best,actually excellent 😎
Thanks is not at all enough for u sir it helped me a lot thanks sir
Absolutely awesome job Sir. Thank you... All cleared
This video was so helpful! thank you!
Tq Bro,U helped a lot,Pls Try to make more questions on this concept
Nice questions about the pointer
assignment of read-only location '*p'
very well stuff .....pls come with more C content & c++
This is a great video. Thank you. 🙏🏽
unique teaching method !
wow thanks gave me a lot of clarity regarding pointers.
So its like, if we have & and * together for a variable, they will cancel out each other
Well explained...I loved it.....
This is awesome ❣️💕💕
thank you very much! this is so brilliant.
Awesome set of videos. from Neso..
excellent explanation
There is a slight mistake or idk what that is! *&p and &*p always prints the address of I. According to normal logic , *&p should print the garbage inside p and &*p should print the address of p! Then why it always prints the address of the pointer "p"?
I love your classes by the way sir !
😁
I think it has something to do with precedence and I think & has the higher precedence maybe. Please correct me if I'm wrong.
int num = 69;
printf("%d
",&num);
int *ptr = #
*ptr = #
printf("%d",num);
this definitely works,
hence last 2 statements at 2:51 are wrong!!!!!
good educational content .
Thank you brother...Love from BD
In question 2:
If we remove const to *p.
Then it is generating o/p 0.
But i variable is also const , then why it is getting o/p.
What's the difference if we use the %u to print address rather than %p?
%u- unsigned integer type
%p- unsigned hexa decimal type
@@sid8130
Thanks a lot,🙇🙇
Nice explanation
Simply Awesome ❤
Thank you so much sir
Great teacher ^^!
Thank you so much.. 😍
Awesome explanation 👍
in q3 int *p=&i is correct or not,because in first question we learn that *p is integer pointer variable which cant hold the address value
It is correct... Because it indicates to the compiler that p is not a simple variable rather than it's a pointer which points to a integer type data... But after declaring a pointer, if we again put a * in front of it this will indicate to the value Stored in the particular address which is stored in the pointer, ie, it will indicate to the integer not to the address of it
It’s different than Q1 because int *p = &i; is a declaration NOT just a C language statement as in Q1! 😮 okay? 😊
We would also have segmentation fault ?
Thank you
Thanks
Tq so much sir 🙏🏻🙏🏻🙏🏻
Here the address is of which data type? It includes integer as well as character!
question 4 was amazing.
What will happen if we write **&p? Is it allowed to write so?
Doesnot give sense
Yes you can write ,it gives value of
i
Thank you sir
error: assignment of read-only location ‘*p’
Bro one thing you told was wrong
We can modify const int value either by pointer or scanf function.
www.onlinegdb.com/online_c_compiler he is correct man, stop misguiding people p.s. you can change it but you have to use non constant pointer to do this.
Sir then what is the significance of the number that is coming in output?
#include
int main()
{
int i = 10;
int *p = &i;
printf("%d", p);
return 0;
}
No the question also is why isn't the second statement declared
hence last 2 statements at 2:51 are wrong!!!!!
Thank u very much
Now pointers are cakewalk
Keep going bro, you're a legend
But what will happen if i = 3000
And I want *i. ???Then will it give a value located a address 3000??
Creative Minds nope u cant directly do this because i is a not pointer but u can give a constant memory adress by your own by doing
İnt *p;
P= 3000;
Now p points the memory adress 3000
Thank you neso
Wow. You rocks. 🤟🤟🤟🤟
Where is your data structur lectures???can't find it??
love you sir
thanks man
thasnk you
Nice video
Evening Sir
Thank u
41:21
slides of this course is available ?
i am getting too much error while writing same same code that you shown .
Why does the address of a variable keep changing?
its never the same value,its a random addres of memory everytime you compile it
int i =10;
int *p = &i;
printf("%p", p) // Instead of this can't I directly do printf("%d", &p); ?
No, because it is considered to be illegal accessing the content of a pointer variable
Sorry , it will print the address
It shows some garbage value
2:41
9:58