cause we are trying to find second highest number here so we gotta keep record of the second highest value. if we would set both to a[0] we would only know highest value
Great explanation!! It would be better if u should an example on an unsorted array, and another example on what happens when a number is less than max1 but bigger than max2
Yes, I would say so, it should work the same way in C++ too. :-) That said you may want to use cout for output instead of printf, using printf in a C++ program is a bit unusual.
Sir , doesnt this approach fail if the highest no. occurs twice in the array in 0 and 1 indexes ?
Why do we need the "else if(a[i]>max2 && a[i]
Hey May I know why do we need to find the first highest and second highest number? Can't we just set both max1 and max2 to a[0] initially?
Are u dumb ?
cause we are trying to find second highest number here so we gotta keep record of the second highest value. if we would set both to a[0] we would only know highest value
You made it look so easy thanks man..
You’re welcome! :-)
true
Thank man it's so easy after watching your video 😊
You’re very welcome, I’m glad to hear the video was helpful! :-)
thank you sincerely
You’re very welcome Stacy! :-)
Great explanation!! It would be better if u should an example on an unsorted array, and another example on what happens when a number is less than max1 but bigger than max2
Showed*
Thanks for the feedback Bisan! 😀
fantastic explaination
I'm really glad you enjoyed it Gaurav! :-)
thank you so much this video helped me a lot :D
You're welcome! :-D
thank you so much
You're very welcome! :-)
what if user input numbers?Is it same?
very easy thanks
I'm glad you found it easy, you're welcome! :-)
Thankyou so much sirrrrrr
You're very welcome! :-)
Good work
Thank you! :-)
Nice logic
I'm glad you enjoyed it! :-)
in for loop the i should be initialize to 0 and not 2.
No, because the first two elements are already accounted for.
@@PortfolioCourses yes ur right...🙌
Is this applicable to Cplushplush?
Yes, I would say so, it should work the same way in C++ too. :-) That said you may want to use cout for output instead of printf, using printf in a C++ program is a bit unusual.
Bahi questions largest two in array in c ?
Sorry I'm not sure I understand your question, can you re-phrase it? 🙂
@@PortfolioCourses hmm.. nothing bro
@@ShivamKumar-rz7uv OK. 🙂
👌
whatever I do or did or anything or know or did not know and whatever I do or why and I will see more like whatever