13:59 int a[]={3,2,67,0,56}; int *p; p=&a[3]; in increment decrement it has right to left precedence, So the 3rd (*--p) will be solved frst the 3rd *--p will decrement and then the value of p will be used for the next expression initial value for *p=a[3] = 0 3rd. *--p = decrement to a[2] = 67 2nd. *--p= decrement to a[1] = 2 1st. *--p= decrement to a[0] = 3 output:- 3 2 67
16:04 printf ("%d %d", *p++ , *p++); // ABNORMALITY in this Code.. The post - inc/dec has associativity , L -> R . But the result, shown seems to be executed from R -> L ('2 3' is output instead of '3 2'). From chatgpt, "The order of evaluation, of function arguments is unspecified in C. It may vary with compilers." printf is a function and here each p++ may be an argument. Hence the variation in order. Conclusion : It's better to not use, more than 1 increment or decrement operator in a Single line of code , to avoid abnormal behaviour. By the way, Thanks Jenny for this amazing lecture series❤
Also, I read that, arguments of printf are evaluated from Right to Left ⬅️ . But when I printed, printf("%d %p", *p++, p); // result= a[0] &a[1] printf("%d %p", *p, p++); // result= a[1] &a[0] It means, whatever the order is, argument with increment is executed at 1st, (for post-inc, the original value of the p is assigned for the ++ argument and then incremented for the next argument. for *p++, it is assigned with address of p and print a[0], Now p= &a[1], and it is printed in the place of p. for p++, it is assigned with address of a[0] and print a[0], Then p is incremented, p=&a[1] and *p = a[1] is printed. Conclusion again : Inc/dec operator itself is dangerous☠️😅
Thank u so much sister for spreading your knowledge... I like very much the way of your teaching... Keep support us and we will always support you sister... Thank u thank u so much....
thanks for the lecture im learning a lot thanks to you I have just a little concern on this topic on incrementation and deference that can happen , I don't know why on your computer is giving you this strange results. In a standard C environment, the expressions ++*p and *p++ are distinct and have different behaviors. ++*p is the pre-increment operator applied to the value pointed to by p. It increments the value before it is used in the expression. So if p points to 3, then ++*p increments 3 to 4, and 4 is the result used in any further expression. *p++ is the dereference operator applied to the value pointed to by p, followed by the post-increment operator applied to the pointer p itself. It dereferences the value (fetches the value 3 in this case) and then increments the pointer to point to the next element in the array after accessing the value. The result used in the expression is the original value before the pointer was incremented.
Ma'am you said associativity of post increment and decrement is left to right and associativity of pre increment and decrement is right to left in your previous video of associativity video
the basic difference between *p++ is here we are incrementing the adresses but in case of (*p)++ means we are incremwnting its value: eg:-> int a[5]={50,1,-1,10,18}; int *p=&a[4]; printf("%d ",(*p)--);// ans= 18 printf("%d ",*p);// ans=17 in case of :-> int a[5]={50,1,-1,10,18}; int *p=&a[4]; printf("%d ",*p--);// ans= 18 printf("%d ",*p);// ans=10
Ma'am can you start some coding from geeks for geeks, it will be a great help if you start placement series, from geeks for geeks, Hacker and leet codes.
char ch =x; char *pch=&ch; printf(" uppercase is %c",*pch-32); output = X; according to what you said *pch should return x's address right ? or increment/decrement different from adding integers ?? please clarify doubt ..........
bro in the print statement u use that indirectionor dereference operator so only its given captial X i think so but i'm not sure about my answer are correct
#include int main() { int a[ ]={3, 2, 67, 0, 56}; int *p=&a[0]; printf("%d", ++*p); return 0; } out puts 4 Would like to share this at 1st p prints 3 as the aesterick marks it at the base index Then increments the value which is 3 by 1 to out put 4 at the console .
n a standard C environment, the expressions ++*p and *p++ are distinct and have different behaviors. ++*p is the pre-increment operator applied to the value pointed to by p. It increments the value before it is used in the expression. So if p points to 3, then ++*p increments 3 to 4, and 4 is the result used in any further expression. *p++ is the dereference operator applied to the value pointed to by p, followed by the post-increment operator applied to the pointer p itself. It dereferences the value (fetches the value 3 in this case) and then increments the pointer to point to the next element in the array after accessing the value. The result used in the expression is the original value before the pointer was incremented.
I wrote this program in visual studio #include #include int main() { int a[] = { 1,2,3,4,5 }; int* p; p = a; //p = p + 4; printf("%d ", *p); printf("%d %d %d ", *++p, *++p, *++p); return 0; } Output is: 1 4 4 4 It looks to me first it is incrementing the value p 3 times and the start printing. ---------------------------- Same observation in pre-decrementing. --------------------------- Anything has been changed ?
#include int main(void) { int a[] = {3, 2, 67, 0, 56}; int *p = &a[3]; printf("%d ", --(*p)); printf("%d ", (*p)++); printf("%d ", ++(*p)); return 0; } This will give -1, -1, 1 In the first printf, *p value is 0 then with pre decrement it becomes -1 In the second printf *p is -1 so it's -1++ which is post increment so -1 is printed but the actual value is now 0. In the third printf it's pretty increment so the 0 becomes 1
13:59
int a[]={3,2,67,0,56};
int *p;
p=&a[3];
in increment decrement it has right to left precedence, So the 3rd (*--p) will be solved frst
the 3rd *--p will decrement and then the value of p will be used for the next expression
initial value for *p=a[3] = 0
3rd. *--p = decrement to a[2] = 67
2nd. *--p= decrement to a[1] = 2
1st. *--p= decrement to a[0] = 3
output:- 3 2 67
I guess 2,3 and garbage value bro..
@@flames_tech no, because he set *p=a[3] ! his result is true !
@@nguyendinhbac7165 but ma'am changed it to a[2] later
You are right 👍
@@flames_tech
16:04 printf ("%d %d", *p++ , *p++); // ABNORMALITY in this Code..
The post - inc/dec has associativity , L -> R .
But the result, shown seems to be executed from R -> L ('2 3' is output instead of '3 2').
From chatgpt, "The order of evaluation, of function arguments is unspecified in C. It may vary with compilers."
printf is a function and here each p++ may be an argument. Hence the variation in order.
Conclusion : It's better to not use, more than 1 increment or decrement operator in a Single line of code , to avoid abnormal behaviour.
By the way, Thanks Jenny for this amazing lecture series❤
Also, I read that, arguments of printf are evaluated from Right to Left ⬅️ . But when I printed,
printf("%d %p", *p++, p); // result= a[0] &a[1]
printf("%d %p", *p, p++); // result= a[1] &a[0]
It means, whatever the order is, argument with increment is executed at 1st, (for post-inc, the original value of the p is assigned for the ++ argument and then incremented for the next argument.
for *p++, it is assigned with address of p and print a[0], Now p= &a[1], and it is printed in the place of p.
for p++, it is assigned with address of a[0] and print a[0], Then p is incremented, p=&a[1] and *p = a[1] is printed.
Conclusion again : Inc/dec operator itself is dangerous☠️😅
14:59 answer is garbage value,3,2
Next one answer is
Segmentation fault
Correct aa bro
@@nikhilpragada1562 next ans will be 1012 1012 1012
p++ pahle print kro phir increment kro
++p pahle increment kro phir print kro
The teacher's lectures are amazing! greetings from Vietnam !
At 11:29 it should be 3,2 as associativity is from left to right .
I too have that doubt
Associativity is from right to left, (
And answer is also correct, it would be 2 3
@@SN-edits4u my compiler returned 3,2. Can you please explain why?
@@roxi-345 here also
2:15 lecture starts
11:06
printf("%d %d",*p++ ,*p++);
it is undefined behaviour. my compiler(visual studio 2019) returns 3 -3 for example.
Thanks my teacher for everything ❤️🌹I understood this lesson after I have saw your episode
The answer is garbage value, 3, 2;
Youve made pointers so easy mum;
At 11:00
When i run
printf("%d %d",*p++,*p++);
my output coming is. : 3 2
But according to you it should be 2 3.
Same iam getting
Can u pls tell in which complier u are performing programs?
It is post increment associativity is from left to right
In pre-increment associativity is from right to left
See 17:40
Actually different compilers have different order of evaluation of printf statement
Generally it is right to left
Thank u so much sister for spreading your knowledge... I like very much the way of your teaching... Keep support us and we will always support you sister... Thank u thank u so much....
Smile while closing session is awesome mam❤❤❤😊😊😊
Wish to present before you &thank you from bottom of my heart.💜
from bangladesh
Thank you so much mam,your are the best teacher i never ever saw in my life,your teaching skills amazing❤
Well explanation mam🎉🎉🎉🎉🎉🎉🎉🎉
Aaj hi padna ka mood aya
Aaj hi a topic samajhna tha
Aur
Aaj hi aapne upload kardiya
😂acha tha na phir tu
1st ans is garbage value,3,2
Your explanation are so simple and easy to understand. I'm studying programming fundamentals and your videos helped me so much. Thank you very much 🙏🙏
from Ensah Morocco best teacher😍😍😍😍
The output of 14:13 will be garbage value, 3, 2
Thank you so much for the explanations, before watching your videos to this point, I really felt dumb.
Isn't it 2,3,garbage value?
@@33_amit okay
Ok but why in the case printf("%d %d",*p++, *p++); it displays result on the other way ?
yeah I know but because 0 WAS the garbage value for me for instance@@33_amit
thanks for the lecture im learning a lot thanks to you I have just a little concern on this topic on incrementation and deference that can happen , I don't know why on your computer is giving you this strange results.
In a standard C environment, the expressions ++*p and *p++ are distinct and have different behaviors.
++*p is the pre-increment operator applied to the value pointed to by p. It increments the value before it is used in the expression. So if p points to 3, then ++*p increments 3 to 4, and 4 is the result used in any further expression.
*p++ is the dereference operator applied to the value pointed to by p, followed by the post-increment operator applied to the pointer p itself. It dereferences the value (fetches the value 3 in this case) and then increments the pointer to point to the next element in the array after accessing the value. The result used in the expression is the original value before the pointer was incremented.
Ma'am you said associativity of post increment and decrement is left to right and associativity of pre increment and decrement is right to left in your previous video of associativity video
Exactly
the basic difference between *p++ is here we are incrementing the adresses but in case of (*p)++ means we are incremwnting its value:
eg:->
int a[5]={50,1,-1,10,18};
int *p=&a[4];
printf("%d
",(*p)--);// ans= 18
printf("%d
",*p);// ans=17
in case of :->
int a[5]={50,1,-1,10,18};
int *p=&a[4];
printf("%d
",*p--);// ans= 18
printf("%d
",*p);// ans=10
Thanks dude
thanks
Thanku mam.... For explaining things... So simply.. 😊✨💐.....
Jenny the Robot
🤖
😂
So true 😂
Yes
Omggg 💯 💯 💯 💞
Ma'am can you start some coding from geeks for geeks, it will be a great help if you start placement series, from geeks for geeks, Hacker and leet codes.
Your every video is very clear mam. Thanks for your understandable lecture ☺️
your each video is very clear mam
Thank you so much this video cleared my all confusions ❤️❤️
ma'am but post increment operator ki associativity to left to right hena ??
Mam has confused at many points
Yes
yes mam please make questions after completing the lecture of C .
Garage,3,2
Yes
Ma'am.When will the classes of C++ start
17:41 mam i am getting output as 3 2 why so mam??
char ch =x;
char *pch=&ch;
printf(" uppercase is %c",*pch-32);
output = X;
according to what you said *pch should return x's address right ?
or increment/decrement different from adding integers ??
please clarify doubt ..........
bro in the print statement u use that indirectionor dereference operator so only its given captial X i think so but i'm not sure about my answer are correct
Best lecture your lovely student ❤️❤️❤️
Hi
Mam
please do lecture on Object oriented Progming in c++
My favorite computer language is c++
@@sujathanarayana2286 Do you know this language very well?
be part of subject madam attracted my attention more 🥰
hello mam, the last one is showing only 1 1 1. don`t get, please help.
Thanks a lot Mam for this lecture!!!
Best teacher ❤️
#include
int main()
{
int a[ ]={3, 2, 67, 0, 56};
int *p=&a[0];
printf("%d", ++*p);
return 0;
}
out puts 4
Would like to share this at 1st p prints 3 as the aesterick marks it at the base index Then increments the value which is 3 by 1 to out put 4 at the console .
👏
n a standard C environment, the expressions ++*p and *p++ are distinct and have different behaviors.
++*p is the pre-increment operator applied to the value pointed to by p. It increments the value before it is used in the expression. So if p points to 3, then ++*p increments 3 to 4, and 4 is the result used in any further expression.
*p++ is the dereference operator applied to the value pointed to by p, followed by the post-increment operator applied to the pointer p itself. It dereferences the value (fetches the value 3 in this case) and then increments the pointer to point to the next element in the array after accessing the value. The result used in the expression is the original value before the pointer was incremented.
output is
some random number
3
2
Kya mujhe koi samjhayega mam ne right to left q evaluate kiye postfix hone ke baojud bhi postfix ka toh left to right hota hai at qno 9:09
thank you my dear mem 🙏, 🙏🙏🙏🙏🙏🙏🙏😍
Thank you so much mam!!❤️❤️
Great explanation 🥳
Mam pls make vedios on dynamic memory allocation
Mam please make a video on String in C programming.
my compiler is following associativity from left to right. I don't know why it is so
Please please make videos on DSA placement specific questions??
10:58 ma'am its undefined behavior wright ??
Me jee aspirant hu mujhe ye subject Ghanta nhi pata par aap bohot cute ho
Thank you mam your lecture is Very Lovely 😍🌹🌹
Thanks for your efforts mam
Nyc sinha
Please you can tell the c++ course also naa mam🙏
Me too.
Is it possible to make GUI, using C library entirely?
answer mila to mujhe bhi batana
if you get the answer let me know
I wrote this program in visual studio
#include
#include
int main()
{
int a[] = { 1,2,3,4,5 };
int* p;
p = a;
//p = p + 4;
printf("%d
", *p);
printf("%d
%d
%d
", *++p, *++p, *++p);
return 0;
}
Output is:
1
4
4
4
It looks to me first it is incrementing the value p 3 times and the start printing.
----------------------------
Same observation in pre-decrementing.
---------------------------
Anything has been changed ?
Mam lec 72 is missing from play list
Pointer and arthematics are different
Good lecture but unnecessary lagging,like there is 7 lecture +2 lecture for pointers ,null void pointers with average video length of 20 min😢
So what's the problem ?
Spreading knowledge is very usefull to all of us thanku sis
*p++,*p++ for post increment associativity is left to right s
we should go from left to right why mam said it is from right to left .
in my compiler it is right to left
Thankyou Jenny!! You explained it very well!!
printf("%d",*p++); -> output is 3 , 2 it is will correct ouput maam
It is right, yha it's taken
for post decrement/increment associativity is left to right, but valuating from right to left . anyone know why
because precedence of post increment/decrement higher than the operator *( asterisk)
@@Rishabh11_12 so we should move from left to right but why mam said right to left
Yes I too have a doubt @Rishabh is saying correct
Is it possible to use the increment and decrement operators in for loop to print the array ?
yes i try
Make a video on how multidimensional array acts as a pointer when used as formal argument for a function
Could you please tell me the gate syllabus for csbs please
Thanku jenny
in c ++ pointer how creat in programming...
14.3 output- any garbage value,3,2...
It is coding process right way
brilliant explanation
Maam printf("%d %d",*p++, *p++); why it reads from right to left in this line ? Even chatGPT not able to give me the answer :(((
It is because of the property precedence. I two things have same Associtivity then prefedence comes into picture
i am coplitely understand look your lecture
printf("%d %d %d
", *p++,*p++,*p++);
Mam this code shows undefined. It's not good idea to use undefined code like this one
In my here also.
Thank you ❤,
You don't take a bractet in printf statement
CAT 👍💯🥰 keep more vedio
Well said madam zi
Program results are not found
Ma'am
make a video Job's on without coding and programming.
Maan big fan of you mam
What is the size of int variable is it 2bytes or 4bytes
It depends on the operating system and the compiler bt mostly jenny use 4bytes to teach.
finally I came here for thinking about my crush
Padhai likhai karo IAS bano🤣🤣
@@technicalspider2547 yes bro but I really want her
@jayanth rao why
@@Btech_holder because
This is not any crush or romance channel
mam, i am getting like 4011434 something same code which I have written while *--p
You don't right p pointer in printf statement
Y so
#include
int main(void)
{
int a[] = {3, 2, 67, 0, 56};
int *p = &a[3];
printf("%d
", --(*p));
printf("%d
", (*p)++);
printf("%d
", ++(*p));
return 0;
}
This will give -1, -1, 1
In the first printf, *p value is 0 then with pre decrement it becomes -1
In the second printf *p is -1 so it's -1++ which is post increment so -1 is printed but the actual value is now 0.
In the third printf it's pretty increment so the 0 becomes 1
Body subject is right
output is
garbage value, 3 , 2
Crt
Thankyou Mam
❤❤❤❤❤❤❤❤❤❤❤❤❤
I love u mam💙💙
Mam can you please make video's in hindi
Mam jac 12th class computer science with C plus plus ka mcq questions and answers krwayiye plz mam
Right, madam zi