C_76 Pointers in C- part 6 | Pointer Arithmetic (Subtraction) with program

  Рет қаралды 178,327

Jenny's Lectures CS IT

Jenny's Lectures CS IT

Күн бұрын

Пікірлер: 128
@devSackey
@devSackey Жыл бұрын
Thanks alot mum. d = p - q = - 4; *q = 25; (means the value at the address of &a[4] which was 11 is now 25); d = q - p = 4; *p = 27; means the value at the address of &a[0] is now 27; q = q - 3 = (1016 - 3*4) = (1016 - 12) = 1004; p = p + 3 = (1000+ 3*4) = (1000 + 12) = 1012; d = p - q = (1012 - 1004) = (8/4) = 2; You are a genius mum.
@bhaskarverma8943
@bhaskarverma8943 2 жыл бұрын
d=-4 *q=25 now (11 is replaced with 25) d=4 *p=27 now(50 is replaced with 27) q=q - 3 (1004) p=p +3 (1012) d=2
@anjalichawla7710
@anjalichawla7710 2 жыл бұрын
🤩🤩
@anshumanbisht6241
@anshumanbisht6241 2 жыл бұрын
ans of last part will be -4
@hasanmahmud4543
@hasanmahmud4543 2 жыл бұрын
@@anshumanbisht6241 you sure?
@biniyamfisseha1096
@biniyamfisseha1096 2 жыл бұрын
@@anshumanbisht6241 he is right d = 2 because the new value of p is 1012 and q is 1004. so (1012 - 1004)/4(int) = 8/4 which is 2.
@mdsharique2386
@mdsharique2386 2 жыл бұрын
d will be - 2 p=p+3 = 1000+3=1003 q=q-3 =1016-3 = 1013 p-q = 1003-1013 = -10/4=-2
@yunusabdul1652
@yunusabdul1652 Жыл бұрын
Happy teacher's day ❤❤My best cs teacher 🎉
@maryannemuthoni5388
@maryannemuthoni5388 11 ай бұрын
1). d - q = -4 2). *q = 25; a[4] is now 25 The array now looks like {50, 1, -1, 10, 25} 3). d = q-p 4 4). *p = 27 The first value, a[0] is now 27 The array now looks like {27, 1, -1, 10, 25} 5). q = q-3 1016 - 12 = 1004 q now points to second value q[1] 6). p = p + 3; 1000 + 12 = 1012 p now points to p[3] 7). d = p - q 1012 - 1004 = 8/4 Separated by 2 elements
@Vitalraj187
@Vitalraj187 3 жыл бұрын
The way of your talking and communication are super mam tq for your videos
@bodeddulapragathi2184
@bodeddulapragathi2184 Ай бұрын
Very glad to see your videos. Getting interest to learn coding only bcz of you Mam. Thanks for the amazing videos and your explaination is peaks
@sonalikawadibhasme8754
@sonalikawadibhasme8754 3 жыл бұрын
Ma'am tussi great ho🙇‍♀️
@yashhokte1020
@yashhokte1020 3 жыл бұрын
Here is the answers of the questions : 1) d = -4 , now after *q=25 it will stored in the a[4] then d = 4 and after *p = 27 it will stored in the a[0] then after q = q-3 the value will be 1 and after p=p-q the value will be 10 and at last after d = p-q here d will be 2.. Thnku so much mam😊
@741ibrahim2
@741ibrahim2 3 жыл бұрын
our institutions should learn from her ki aise phadate hai !!!!!!!!!!!!!1
@yashhokte1020
@yashhokte1020 3 жыл бұрын
@@741ibrahim2 same.. She deserves more better than what she had now
@palakrai46
@palakrai46 2 жыл бұрын
No.... d=p-q will be -1 Because of 1000-1004=-4 And, then divide -4by 4 then the answer will be -1.
@madhavahuja3590
@madhavahuja3590 2 жыл бұрын
@@palakrai46 no your answer is incorrect i think.
@hasanmahmud4543
@hasanmahmud4543 2 жыл бұрын
@@palakrai46 q is pointing to a[4] pls check it.
@megh5013
@megh5013 2 жыл бұрын
Thanks a lot Mam for this lecture!!!
@praveensamuel8083
@praveensamuel8083 3 жыл бұрын
1) d=p-q -4. 2) *q=25; value is assigned to @address 1016 means 11 is replaced with 25 y bcoz we are using assignment operator (=). 3) d=q-p ans=4. 4) 27 is assigned@address value of 1000. 5) q=q-3 ans. @address 1004 value is 1... 6) p=p+3 ans. @address 1012 value is 10 correct me if I'm wrong... #EEE student .. lots of love from Telangana state mam💙 Note: p-q results will give us as a integer value... by dividing size of data type and p-2 results will give us as a address value
@tamilelakkiyathennarasu971
@tamilelakkiyathennarasu971 3 жыл бұрын
d=p-q is 4 is it correct
@praveensamuel8083
@praveensamuel8083 3 жыл бұрын
@@tamilelakkiyathennarasu971 ...wrong correct and is -4
@souviknandi5792
@souviknandi5792 3 жыл бұрын
@@praveensamuel8083 yes..
@souviknandi5792
@souviknandi5792 3 жыл бұрын
3) d=q-p ans=4...vaiya can you plz describe this line for me...plz!!!
@souviknandi5792
@souviknandi5792 3 жыл бұрын
ans. @address 1004 value is 1.. I Think It Is (-1)....for q=q-3.
@bawaabdulsilas3681
@bawaabdulsilas3681 Жыл бұрын
In the first line d = p - q; p is pointing to 1000 and q to 1004 Therefore d = (p - q)/4; d = (1000 - 1004)/4; d = -4/4; ultimately d = -1. The second line dereference q by reassigning its value to 25, so therefore, the value at address q now stores 25. The third line d = q - p; Note that the values of addresses of p and q hasn't changed yet, Therefore d = (q - p)/4; d = (1004 - 1000)/4; d = 4/4; so ultimately d = 1. The fourth line *p = 27, reassigned the value of the address pointed to by p to 27. The fifth line q = q - 3, can be evaluated as follows Note also that p and q are still pointing to the same address as above. q = q - (3 * 4); q = 1004 - 12; therefore q = 992; meaning that q is now pointing to address [992] if any, and that too on the left hand side of p. Line six gives p = p + 3; As usual p = p + 3; p = 1000 + (3 * 4); p = 1000 + 12; p = 1012; this means that p now points to this address [1012] in the memory. And finally on line 7, d = p - q; Now note that the address of p and q have both changed p points to 1012 and q to 992 (if is a valid address) Therefore, d = (p - q)/4; d = (1012 - 992)/4; d = 20/4; d = 5.
@goplay5936
@goplay5936 Жыл бұрын
q is pointing to 1016
@bawaabdulsilas3681
@bawaabdulsilas3681 Жыл бұрын
@@goplay5936 We have many instances of q, so state your case clearly please. At what stage is q = 1016?
@simon-gh1pt
@simon-gh1pt Жыл бұрын
@@bawaabdulsilas3681 at first
@mehendidesigns9345
@mehendidesigns9345 3 жыл бұрын
Mam pls make video on dynamic memory allocation after pointer
@shraddhapawar5674
@shraddhapawar5674 3 жыл бұрын
Just go through Maam dsa lec, you will get concept
@ashwani8014
@ashwani8014 3 жыл бұрын
Pahle mai bahut garib hua karta tha fir ek dost ne mughe dream 11 ke bare me bataya ab main gareeb Ke sath sath kargdaar v hu
@techcode_world
@techcode_world 9 ай бұрын
mam but we can add like *p=*p+*q int a=2; int *p=&a; int *q=&a; *p=*p+*q; printf("%d",*p); output: 4
@dreypraydev
@dreypraydev Жыл бұрын
These are the results for the 7 mini exercises so you can verify yourself, guys. 1. d = -4; 2. *q = 25 => a[4] = 25; 3. d = 4; 4. *p = 27 => a[0] = 27; 5. q = 1004; 6. p = 1012; 7. d = 2;
@SunilYadav-nb9wp
@SunilYadav-nb9wp 3 жыл бұрын
Why we use pointer ?
@etceterafans2345
@etceterafans2345 3 жыл бұрын
11:08 you said the expression p=p-1 gives you a garbage value. but i run that it gives answer like previous one's. whatever we get while q pointer, also i got in p pointer. in subtraction we just find difference between address of value stored. if suppose we use d=*q-*p we can get subtraction of value stored there. so on that expression we can't get p=p-1 value. there we will get garbage value
@crazyloveever2462
@crazyloveever2462 3 жыл бұрын
We won't get the same in all the compilers bro
@arshuarshad1551
@arshuarshad1551 Жыл бұрын
i got garbage value after run
@palakrai46
@palakrai46 2 жыл бұрын
Answers:- d=p-q=-1 *q=replace 10with 25 d=q-p=1 *p=replace 0with 27 q=q-3=992 p=p+3=1012 d=p-q=5
@hasanmahmud4543
@hasanmahmud4543 2 жыл бұрын
Wrong answer
@hasanmahmud4543
@hasanmahmud4543 2 жыл бұрын
Go & study more🤣✌️
@shyamsuratyadav655
@shyamsuratyadav655 3 жыл бұрын
Tysm ma'am great work 👍🏾
@meghasinha1706
@meghasinha1706 3 жыл бұрын
Thanks for your efforts mam
@elitepixel0
@elitepixel0 3 жыл бұрын
Mam please make video on String in C Programming
@monikamohanty3619
@monikamohanty3619 3 жыл бұрын
Already hai , channel main
@jyotirmayapanda302
@jyotirmayapanda302 2 жыл бұрын
Why we are not able to add two pointer where as we can substract two pointer?
@piyushjoshi4618
@piyushjoshi4618 7 ай бұрын
Because adding 2 pointers will result in a very large value
@ghanatheaarthi6673
@ghanatheaarthi6673 3 жыл бұрын
Mam after completing c pls do c++ also
@adrikamukherjee5607
@adrikamukherjee5607 Ай бұрын
Ma'am where do you live? Do you provide any live coaching classes offline or online? Please let us know
@shivarajgugri113
@shivarajgugri113 2 жыл бұрын
d=(p-q)/bytes. Or d=(p-q)/bits Plz reply me mam
@nehanthv4238
@nehanthv4238 2 жыл бұрын
It's d=(p-q)/.Size of an integer datatype is 4 bytes...So, its bytes
@qemmm11
@qemmm11 Жыл бұрын
Thanks!🫡
@theenglishspeaker827
@theenglishspeaker827 2 жыл бұрын
Mam but Where we use pointer arithmetic?
@endlessloopsoftwares4724
@endlessloopsoftwares4724 3 жыл бұрын
Me who is here just to see that smile which is my motivation....
@MaheshKumar-jz9mr
@MaheshKumar-jz9mr 3 жыл бұрын
Mam u r so cute😁😍🤭
@himanshu-x8s6b
@himanshu-x8s6b 2 ай бұрын
thank you mam ji
@kushchauhan4116
@kushchauhan4116 3 жыл бұрын
in pointer variable int. submit ho jati hai..
@missankitabose1783
@missankitabose1783 3 жыл бұрын
d^p-q; Output :4 Thn *q^25; d=q-p; Output : 4 *p^27; q^q-3; p^p+3; d^p-q; Output ^2 Ma'am please tell me is my answer right or not?
@praveensamuel8083
@praveensamuel8083 3 жыл бұрын
first one ans is negative value it's -4
@missankitabose1783
@missankitabose1783 3 жыл бұрын
Yeah as it is p-q ...
@souviknandi5792
@souviknandi5792 3 жыл бұрын
@@praveensamuel8083 yes...
@SwetaKumari-ps2rf
@SwetaKumari-ps2rf 3 жыл бұрын
@@praveensamuel8083 yes ur right
@palakrai46
@palakrai46 2 жыл бұрын
Wrong first one is -1.
@tejhimanshu
@tejhimanshu 2 жыл бұрын
At 17:38, q-p= -1, how?
@bhagyashrijadhav1158
@bhagyashrijadhav1158 2 жыл бұрын
Because, *q=4 and *p=3 Suppose we consider, Addresses like 1000, 1004, 1008, 1012, 1016 to the values. Then the address of q is 1004 and address of p is 1008. q-p = 1004 - 1008 = -4/4 = -1.
@tejhimanshu
@tejhimanshu 2 жыл бұрын
@@bhagyashrijadhav1158 got it Thanks
@sadabshiper7597
@sadabshiper7597 2 жыл бұрын
int a[] = {50, 1, -1, 10, 11}; int *p = &a[0]; int *q = &a[4]; statement - 1: d = p - q; or, d = -4 statement - 2: *q = 25; so value of a[4] will be replaced by 25, ie a[4] = 25 so new array would become : a[] = {50, 1, -1, 25, 11}; statement - 3: d = q - p; or, d = 4 statement - 4: *p = 27; so value of a[0] will be replaced by 27, i.e. a[0] = 27 so new array would become : a[] = {27, 1, -1, 25, 11}; statement - 5: q = q - 3; This means index of q will be moved left by 3 positions. So *q will point from q[4] to q[1] that is *q = a[1] = 1 statement - 6: p = p + 3; This means index of p will be moved right by 3 positions. So *p will point from p[0] to p[3] that is *p = a[3] = 25; statement - 7: d = p - q; or, d = 3 - 1 or, d = 2
@aswathkumar18
@aswathkumar18 2 жыл бұрын
13:14 For statement- 2, I think the array will be like a[ ] ={ 50,1,-1,10,25} Correct me if I'm wrong!
@Bhabukrijal
@Bhabukrijal 3 жыл бұрын
नमस्ते । म हजुकाे भिडीयाे नियमित हेर्छु । म सुर्खेत नेपालबामट हेरिरयकाे छु।।
@GauravThakur-hz3zi
@GauravThakur-hz3zi Жыл бұрын
Is Ans of d is 8???
@gd2854
@gd2854 Жыл бұрын
Zebra ma'am ❤
@motemontero5592
@motemontero5592 3 жыл бұрын
Madam please 🙏please 🙏 🙏 we need GTK for c programming
@Samarora06
@Samarora06 2 жыл бұрын
I enjoy the study when all teachers look like u
@rishavchowdhury5954
@rishavchowdhury5954 3 жыл бұрын
Everybody here is to tell her that how cute she is. So indian!
@shashank_kishore_
@shashank_kishore_ 2 ай бұрын
❤❤❤❤❤❤❤❤❤❤❤❤❤
@rajasekhar8848
@rajasekhar8848 Жыл бұрын
madam c language bahubali anukunara...prati topic ki part1,part 2 ani chestune poyaru. for the first time bahubali movie kuda short film la anipichindi me vedeos mundu...any ways tq for good explanation.😭
@vigneshwaran_2002
@vigneshwaran_2002 3 жыл бұрын
Mam c++ pointers videos upload please
@BTCIV_AyushMalviya
@BTCIV_AyushMalviya 2 жыл бұрын
Thankyou Mam
@williemungai1954
@williemungai1954 2 жыл бұрын
d=3; *q = 25/*25 replaces the value 11 in a[4]*/ d = 4; *p = 27/*27 replaces the value 0 in a[0]*/ q = now stores &a[1]; p = now stores & a[3]; d = 4;
@user-no5ns8wp4t
@user-no5ns8wp4t 2 жыл бұрын
Thx
@SravanKumar-uc6qt
@SravanKumar-uc6qt 3 жыл бұрын
Looking so Grosgeuss madam zi
@YOUTUBECOMMENTER...
@YOUTUBECOMMENTER... 3 жыл бұрын
Jenny's so pretty 😍
@nandinil8723
@nandinil8723 Жыл бұрын
Can any one please explain at 15:25.......how q-p=3 and p-q=-3
@deepikapampanaboyina
@deepikapampanaboyina 2 ай бұрын
Here is the answer q has address 1000a and q has a address 1012 when subsract the two different pointers we have to divide by size of data type that means p-q/size of data type =1000-1012/4=3
@itzharivlog273
@itzharivlog273 3 жыл бұрын
Python ka bhi video banaoo
@orsusaikumari6302
@orsusaikumari6302 3 жыл бұрын
I love u mam
@rapakalokesh8449
@rapakalokesh8449 Жыл бұрын
take care maam 😉😉
@aasanhai18
@aasanhai18 6 ай бұрын
d=-4 p=1012 q=1004
@coding_with_bf
@coding_with_bf Жыл бұрын
Mam index is starting from 0 ,when we move on to backward of the index of 0 . What will be there? -1 or anything 😢
@ABIRAJP-dm1di
@ABIRAJP-dm1di Жыл бұрын
some garbage value of other address
@coding_with_bf
@coding_with_bf Жыл бұрын
@@ABIRAJP-dm1di thank you
@amitparmar4567
@amitparmar4567 3 жыл бұрын
Ap bahot beautiful hoo, Love u ❤
@shyamsuratyadav655
@shyamsuratyadav655 3 жыл бұрын
First one to comment
@_getrichnow
@_getrichnow 2 жыл бұрын
d will be 2
@milenazafirova7754
@milenazafirova7754 2 жыл бұрын
//Subtraction of pointers; Homework: #include int main() { int i; int d; int a[] = { 50, 1, -1, 10, 11}; int *p = &a[0]; int *q = &a[4]; printf("\tSubtraction of pointers. Homework: "); printf(" "); printf("address of p: %u ", p); printf("address of q: %u ", q); printf(" "); d = p - q; printf("Difference is: %d ", d); *q = 25; printf("Array a: "); for(i = 0; i < 5; i++) { printf("%d\t", a[i]); } printf(" "); printf("Updated value of q is: %d ", *q); printf(" "); d = q - p; printf("Updated difference is: %d ", d); printf(" "); *p = 27; printf("Updated array a: "); for(i = 0; i < 5; i++) { printf("%d\t", a[i]); } printf(" "); printf(" "); q = q - 3; printf("Updated address of q is: %u ", q); printf("Updated value of q: %d ", *q); printf(" "); p = p + 3; printf("Updated address of p is: %u ", p); printf("Updated value of p: %d ", *p); printf(" "); d = p - q; printf("Difference between p and q is: %d ", d); printf(" "); printf("Elements of array a after subtraction: "); for(i = 0; i < 5; i++) { printf("%d\t", a[i]); } printf(" "); } OUTPUT: Subtraction of pointers. Homework: address of p: 924154144 address of q: 924154160 Difference is: -4 Array a: 50 1 -1 10 25 Updated value of q is: 25 Updated difference is: 4 Updated array a: 27 1 -1 10 25 Updated address of q is: 924154148 Updated value of q: 1 Updated address of p is: 924154156 Updated value of p: 10 Difference between p and q is: 2 Elements of array a after subtraction: 27 1 -1 10 25 💙
@skmannan6495
@skmannan6495 2 ай бұрын
Pyu😂😅😅😅
@akhilsugaraju3905
@akhilsugaraju3905 2 жыл бұрын
Can any one explain in addition we can't do P1+P2 But in subtraction how can we do p2-p2 or p1-p2.explain pls.
@Vitalraj187
@Vitalraj187 3 жыл бұрын
Hai mam😍
@anushajade3791
@anushajade3791 Жыл бұрын
Mam changed the marker😂
@DeepanshuKumar-zu4gv
@DeepanshuKumar-zu4gv Ай бұрын
In last answer is 0
@amitparmar4567
@amitparmar4567 3 жыл бұрын
Love u
@abhishekkumarjha4314
@abhishekkumarjha4314 3 жыл бұрын
❤️❤️❤️❤️❤️.
@pradeeprao2473
@pradeeprao2473 3 жыл бұрын
❤️👍
@TheChemistryTeacher
@TheChemistryTeacher 3 жыл бұрын
Being a jee aspirant just Watching...That what's going on the whiteboard....??
@gouravsonu2296
@gouravsonu2296 2 жыл бұрын
Answer is -4 11 will be replaced by 25 4 50 will be replaced by 27 Again 25 will be replaced by 1 Again 50 will be replaced by 10 2 Thanks 🙏
@ragnarlothbrok367
@ragnarlothbrok367 2 жыл бұрын
Some random indian girl > my entire career
@durgeshkushwaha2534
@durgeshkushwaha2534 3 жыл бұрын
Mam, please Hindi me padhaeye 🙏🙏
@ankanroy4718
@ankanroy4718 3 жыл бұрын
ম্যাডাম vidyasagar University-র 3rd semister-এর exam online হবে না offline-এহবে।
@RajanSingh-tz6ud
@RajanSingh-tz6ud 3 жыл бұрын
Hindi bolna mna hai kya
C_77 Pointers in C- part 7 | Pointer Arithmetic (Increment/Decrement) program
21:03
C_75 Pointers in C-part 5 | Pointer Arithmetic (Addition) with program
23:18
Jenny's Lectures CS IT
Рет қаралды 252 М.
진짜✅ 아님 가짜❌???
0:21
승비니 Seungbini
Рет қаралды 10 МЛН
번쩍번쩍 거리는 입
0:32
승비니 Seungbini
Рет қаралды 182 МЛН
ССЫЛКА НА ИГРУ В КОММЕНТАХ #shorts
0:36
Паша Осадчий
Рет қаралды 8 МЛН
«Жат бауыр» телехикаясы І 30 - бөлім | Соңғы бөлім
52:59
Qazaqstan TV / Қазақстан Ұлттық Арнасы
Рет қаралды 340 М.
C_81 Null Pointer in C | C Programming Tutorials
21:34
Jenny's Lectures CS IT
Рет қаралды 124 М.
Learning C# In A Week... Otherwise I Fail University
9:04
C_87 Functions in C- part 4 |Call by Value & Call by Reference in C
25:49
Jenny's Lectures CS IT
Рет қаралды 374 М.
C_80 Void Pointer in C | Detailed explanation with program
18:05
Jenny's Lectures CS IT
Рет қаралды 155 М.
Pointer Arithmetic (Addition)
7:10
Neso Academy
Рет қаралды 252 М.
C_74 Pointers in C- part 4 | Pointer to Pointer (Double Pointer)
25:06
Jenny's Lectures CS IT
Рет қаралды 283 М.
C_119 File Handling in C - part 1 | Introduction to Files
12:15
Jenny's Lectures CS IT
Рет қаралды 380 М.
진짜✅ 아님 가짜❌???
0:21
승비니 Seungbini
Рет қаралды 10 МЛН