C_72 Pointers in C- part 2 |Address of(&) and Indirection (*) operator in Pointers I C Programming
Вставка
- Опубліковано 9 сер 2021
- In this lecture we will discuss:
- What is Address of(&) operators?
- What is Indirection Operator(*)?
- how to use Address of(&) and Indirection(*) operator?
Best C Programming Tutorials: • Programming in C
*********************************************
Connect & Contact Me:
Jenny's Lecture Hindi: / @jennyslectureshindi
Facebook: / jennys-lectures-csit-n...
Quora: www.quora.com/profile/Jayanti...
Instagram: / jayantikhatrilamba
Twitter: / khatrijenny
Telegram Group Link: Jenny's Lectures
telegram.me/jennyslectures
*******************************************
More Playlists:
Programming in C Tutorials: • Programming in C
C++ Tutorials for beginners: • Lec 1: How to Install ...
Printing Pattern in C: • Printing Pattern Progr...
Best Python Tutorials for Beginners: • Python - Basic to Advance
Placement Series: • Placements Series
Data Structures and Algorithms: https: • Data Structures and Al...
Design and Analysis of Algorithms(DAA): • Design and Analysis of...
Dynamic Programming: • Dynamic Programming
Operating Systems tutorials: // • Operating Systems
DBMS Tutorials: • DBMS (Database Managem...
Tags:
pointers in c, what is pointer, introduction to pointers in c
#coding #strings #jennyslectures #cprogramming #clanguage
Today is March 1st which is your birthday wish your a very happy birthday🎂🎂the best programming teacher on youtube
Ur birthday is also come on 1st March!
c = *q;
*p = 20;
Output would be c = 9 and a = 20. While p = the address of a in a hexadecimal form
Mam you deserve the word "Teacher" !!!!
ua-cam.com/video/oWtizowZYBc/v-deo.html
Perfectnaa!
world teacher not word
She is a teacher indeed lol!
yes
according to the above block of code:
int a =10, b = 9;
int c;
int *p,*q;
p=&a;
q=&b; // the pointer 'q' declaration here means that the address-of 'b' is assigned as
// the value of q
c = *q; // here is the declaration of c to *q or &b. This means that using the indirection
// operator or dereferencing * operator: the value of the variable is accessed.
// in this case the variable is 'b'
*p = 20; // this will manipulate the value of the variable which p points to: 'a'
// 'a' variable was initially 10 now value will be '20'
printf("c = %d",c) // the output will be exactly the value at variable 'b'
printf("a = %d",a) // the output will be the current assigned value to *p which is 20
🏑🏑i hope this was helpful to someone to understand better the output of c.
Nice explanation, Just wanted to add in the line c = *q; it basically means that c = 9; because dereferenced q is pointing to the value of b which is 9.
Yea: exactly.. thank you.
c = 9
understood . thanks
Best teacher of computer ever. Keep it up👍
Ans
C=9
a=20
P= address of a in hexadecimal format
Value of a might be 10 only as ma'am has written %d then a and in the starting of prog value of a is 10.
here a=*p,
so the value of a is 20 only
here we are assigning new value to *p so the value of a is 20 ...
correct me if I'm wrong 😶
*p= 20; i.e value at address of a(here 1000) so *(1000) = 20 or simply a= 20
@@praveensamuel8083 bro a=*p is not declared at all
How can you say that it's out put is 20 .
It's 10 for sure
@@neelirahul7892 Nope, a = 20.
Look again at the second original printf statement: printf ("a = %d", *p) , 10
It's an instruction to print "a =" value of *p. It was written to show you that this is so, even though it isn't formally declared. a = *p is inferred from p = &a:
a = 10, p = &a
p points to the address of a (&a).
*p points to the value held at &a.
&a is the location that holds the value of a.
*p points to the value of a.
a = *p
*p = 10
Both a and *p are the same data stored in memory at &a, so cannot be two different values. As long as p = &a, for *p = 20 to be true it must override a = 10. If you don't understand this you can accidentally overwrite your variables when using pointers.
C= 9
a= 20
p=ADDRESS OF A IN HEX FORM
you summed it perfectly...but why have to written c
Here value of a is incorrect
@@universe449 why??
They didn't declare a value of C then how will you assign the value of C is 9?
Could you please explain to me, why p will be the address of a (in hex form)? why specifically in hex format?
As we taken c=*q which means *q gives the value of b. Because q=&b;
*q = value of b. Therefore the c=b;
C= 9.
shiny rao u rocked !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Right
Yes
Yes
You are wrong
Great video, thanks, Jenny. So, there are two pointer operators: * and &. The & is a unary operator, called “Address of” or “Reference operator” that returns the memory address of its operand.
For example,
j = &i;
assigns the address of i into j. This address is the computer's internal location of the variable in memory. It has nothing to do with the value of i. You can think of & as returning "the address of". Therefore, the above assignment statement can be expressed as "j receives the address of i".
The second pointer operator, *, called “Value at address” or “Dereference operator” or "Indirection operator" is the complement of &. It returns the value located at the address that follows. For example, if j contains the memory address of the variable i,
k = *j;
copies the value of i into k.
Hope that was helpful. :)
Excellent explanation
Yes Thank You 🙏❤️ Nice Explanation 🙏❤️👏
Best teacher of computer ever.
I'm in the middle of doing my CS course, and this helps me a lot on understanding pointers (which apparently is a very hard subject that even the veterans hates).
She's a great teacher.
Thank you soo much mam ❤️😀
I have understood clearly.
Best teacher of computer in india
Mam whenever you teach us everything is FINE!
She got me through my bachelor in computer science more than any teacher at Uni
Best teacher I have ever seen in my life😃😃🙏
Kaha se ho??
The printf("C = %d, c) will give us 9, the printf("a = %d", a) will give us 20 and the printf("%x", p) will give us 0x8000.
correct
@@heysuraj-ik1rd Thank you...
How pls explain a and p values
@@nandinil8723 p is storing the address of a, that is it has a direct access to whatsoever value that is stored in a, so when you dereference p, what you get is the direct value of a, so dereferencing p and giving it a value of 20 is the same as updating the value stored at the address of a, which initially was 10 to the new value, which is now 20. I believe you understand it now?
@@nandinil8723 While p is the hexa-decimal value of p, that's the hexa-decimal value of 20.
Thanks ma'am your video clear my all doubt ☺️
best teacher ever !thank you so much
C = 9
A= 20
P = hexadecimal number
if you suddenly open 15:38 it looks like b=a lol, in that case value of C would be 10 which I thought, because it looked like that to me lmao
9
Thanks mam me 5 din se smjh nhi pa rha tha pointer apka video dekha smjh agya
Mam you are amazing
I always watch only your video when i don't understand in my college
You are better than my college teacher
c=&q which means c=*(&b) value at memory location of variable b.
*p = 20 this means *(&a) value 20 will be stored at variable a and will pointer will point to address of memory a
Absolutely, if we use *p or *(&a).
Your class is awesome mam❣🥰
mam waited for pointers for a long time thanks for start uploading mam!!.please post all videos as soon as possible mam.please try to upload 2 videos per day mam.Thank you mam.
mam thanks lot your teaching style is very awesome slowly slowly helps me to understand all the topics
thanks a lot mam you are best
Mam I like your way of explaining the subject to students 👌, you are the best programming languages teacher for me......
For second question it's not clear whether ma'am had declared the value of a as 10 or 20.
If you declare value of a as 10 then the output will be 10, if you declare it as 20, output will be 20. (run the code on your PC to verify)So value of a cannot be updated using *p. Whatever the value of a is declared first that will be printed.
And for the third one it will print address of a in hexadecimal form
Today is mam interview and these video is so beneficial for me💜
very beautiful teacher.
truely. that itself keeps us hooked 😅
my favourite teacher and first choose of CS
Thanks ma'am for making this video it's very useful
Thanks a lot! Your class is helping me achieve the impossible
*p=20; which means value of a will be overwritten by 20.a=20;
superb explanation madam
Mam c=9 only
As you told us to comment on
C=*q
So it must be 9
In the program while you were running you have given
C=*p
Which will give a value 10
I got it mam
Thanks
C=*q
That means it should print value of 'C' but where Is C value
thank you soo much jenny madam❤
Since, q is carrying the address of b, so *(&b) = b. So, the output will be 9.
i like your video...thx ma'am
a) c = *q , then value of c is 9
b) *p = 20 means value at (&a) is 20.
c) value of p is address of 'a' in hexadecimal form.
Thanks bro for this easy way
Can you pls tell me how the value of a is 20
@@alaharianuhya9523 we used there indirectional operator that is * which prints the value of 'a' at address of 'a'
(As we already declared above that 'p' stores the address of the variable 'a')
Thanks for your efforts mam
very very thank you so much ma'am
Thank you for lecture
The value of a now is override by 20 output is 20 for a value mam
Thank you so much mam 🏵️🏵️🏵️... really greatful to you mam
what I understood I
if we initialize
int a=10;
int *p;
p=&a;
*p=44;
printf("%d", a);
then it will print a=44;
i think here we are changing the value stored in a through pointers
i.e if p is having address of a
the *p says value stored at the address
means if we initialze *p =44; means we are initializing value to a.
Thanks a lot Mam for this lecture!!!
Megh I love tou
Answer
C=9
a=20
P=it store the address of other variable in hexa decimal form...
Ma'am you are literally the best teacher ever!!!!
No one can beat u in being the best teacher ever for C programming.
Thank you very much mam 🙏🙏🙏
Best teacher in the world❤🩷💛
New to the channel. I like your style of teaching. Keep up the good work!
ua-cam.com/video/oWtizowZYBc/v-deo.html
Nice teaching
thnks mam it was exam.time you cleared me before going to exam......and the exam was practical exam.🥲
your classes are awesome 😎😎😎 mam
Mam it's very useful mam,can you please upload the videos of protocols like spi,i2c,can, UART
a = 10
P = 1000EF( in hexadecimal form)
C = 9
A will be 20 bro change kar di hai val. A ki pointer se
@@kushpreetbakshi4828 hello.
Value is coming out to be 10 when I run it in VS code.
And after this
I also print
Printf("%d", *p) ;
So value is coming 20 there.
How come?
Thank you very much mam now concept is very much clear.
ua-cam.com/video/oWtizowZYBc/v-deo.html
One of the great gift for Indian students..
It's very useful mam thanks for this information
ua-cam.com/video/oWtizowZYBc/v-deo.html
Thank you mam for uploading this.
ua-cam.com/video/oWtizowZYBc/v-deo.html
best mam ever.❤❤
Thank you mam
Ma'am if possible, upload video fast.
Nice lecture 👍
Best lecture ever seen..
Happy Birthday mam ❤
Excellent job
Amazing video.
thank you so much mam
c outputs 9
the value of a is 20
p prints the memory address of a in hexadecimal
Now i can understand pointers
in case of printf("c= %d", c); the address of pointer q is printed in integer format.
next incase of printf("a= %d ",a); value of a willl be printed that is 10.
Hii
@@sampathsam5032 hey
mam in c : b value
and a value is over written
and address of p is same
thank you mam
Printf ("%x",p) gives adress of p in hexa decimal form
Mam aap bhout acha padhate hoo
value of c = 9 because c is initialised to hold the value of the pointer q(which houses the address of b), which turns out to be 9. Hence, value of c printed would be 9. In case 2, the value of the address p holds (*p) is modified in memory to 20. The address p holds is of variable and since *p is modified, it means a has been modified (or corrupted). Hence the value of a printed would be 20. In the last case, p would print the address of the variable a, didn't change throughout the program.
ThankYou Mam
hyderabad secunderabad jenny madam zindabad...
ua-cam.com/video/oWtizowZYBc/v-deo.html
1--
c=*q; this will assign value of memory address that is stored in q so c will become 9
2--
a=10;
*p=&a;
*p=20;
this time value 20 is assigned to a variable and its orignal value is overwritten by this
Why can't Lecturers teach with passion like this? 🤦
Thank u very much mam.💪💪👍👍🙏🙏❤❤
ua-cam.com/video/oWtizowZYBc/v-deo.html
Thank you mam.
printf("c=%d",c); output is: 9
Thanks mam alot😍😍😍😍😍😍😍
Example of beauty with brain 🥰🥰
ua-cam.com/video/oWtizowZYBc/v-deo.html
Haappyyy Birthday Mam!🎉 Grateful for ur videos❤
Great ma'am
Mama your teaching is excellent keep doing video
value of c == value of b and a becomes variable so it leaves 10 value and it will get new value that is 20 a=20 and p=20
Since the value of c is the pointer q, c = 9.
a= 20
p= address of a in hexadecimal form
c=9
Hi nikita❣️❤️
Namaste ji, can u pl provide tutorial on Oracle 10g...in Hindi
ankit and pulkit will remember forever
Well done
Tq mam
Completed the course in 1 day for exam
c=*q; since q stores address of b so the value at that address will be stored in c i.e 9
We NEED GTK+ FOR C PROGRAMMING AFTER COMPLETING THE C
Madam |G Thank You ""Good Job
ua-cam.com/video/oWtizowZYBc/v-deo.html
C = 9
a = 20
p = address of a ( hexadecimal number )
q contains the address of b(q=&b)
*q contains the value of b=9
So c=9(c=*q(
Better than our academic lectures..
hey army ..!
@@mohithar1110 hiiiii💜💜
Wow I can see army's every where 💜🥰