even after 8 years ,these tutorials are still masterpiece
@greagarious4411 жыл бұрын
I m a Masters Student and I must say that your tutorials are highly professional and clear. Your channel is a must watch !!
@turing_machine5444 жыл бұрын
He is a legend ..watching in 2020 (1st year college student)
@Razvi8 жыл бұрын
These tutorials are helping a lot of people out there and they will never get outdated. I agree with your words about meritocracy in industry instead of actual skills. Thank you :D
@row-v8o2 жыл бұрын
for future references (or anyone watching this video) at 4:20, some of us may get different outputs. the size of a pointer variable in his system (32 bits) will be 4 bytes, but the size of pointer variable in 64 bit systems will be 8 bytes. So dont be surprised when u obtain a different output!
@nathamuni9435 Жыл бұрын
sizeof(A) = 8 , sizeof(A[0]) 4 Sum of elements = 3 sizeof(A) = 20 , sizeof(A[0]) 4 -------------------------------- Process exited after 0.6451 seconds with return value 31 Press any key to continue . . . mine
@СтасюкАндрій5 ай бұрын
yep, just wondered why is that a thing thank you!
@leixun4 жыл бұрын
*My takeaways:* 1. When compiler see an array is passed (by value) to a function argument, it will not copy the entire array to the function, instead it will create a pointer to the first array element. Therefore, it is essentially pass by reference 2:53 2. We need to pass the size of array specifically to called function 9:00
@mehulsaini96454 жыл бұрын
bro can u tell what's wrng in my code,plss as in this video he said that 'int *a' is equal to 'int a[]' so instead of 'int*fun(int)' i used 'int [] fun(int)',but its not working : //// #include using namespace std; int [] fun(int n) { int *p; p=(int *)malloc(n*sizeof(int)); return (p); } int main() { int *a; a=fun(5); return 0; } //////
@gamoholic76533 жыл бұрын
@@mehulsaini9645 int* a equals to int[a] was only valid for formal parameter not as a return type..
@MohitSingh-om8jt5 жыл бұрын
Absolutely incredible. Never thought pointers could be taught so gracefully
@ahmedsamy-lc1ux8 ай бұрын
11 years later and this is still Legend👐
@shivamverma94474 жыл бұрын
This video of 13min will clear all your doubts........This teacher is just amazing.....
@BL4S7ER11 жыл бұрын
I have no C experience but have used other languages. I spent alot of time searching for decent tutorials on C. Your videos are well explained, informative and delivered well. *EXCELLENT Thank you for taking the time and effort to produce them.
@vigneshmanoharan37709 жыл бұрын
For those of you working in 64 bit OS, the size of pointer would be 8, instead of 4 as shown in video.
@hussameldinrabah50189 жыл бұрын
+Vignesh Manoharan in dev c++ compiler, we have 8 bytes int .. in Codeblocks, 4 bytes >> my laptop is 64 bit OS
@saurabhkumarjha49966 жыл бұрын
he is stupid bro
@adrijabose45984 жыл бұрын
Ya thanks I had this confusion
@mrlegend39832 жыл бұрын
Thanks bhai
@youssefandroid65128 жыл бұрын
سبحان الله الله يجزيك بالخير اخي مشاء الله شرح راءع الله يجعله في ميزان حسنتك
@codekarlebhai Жыл бұрын
watching in 2023, still relevant and far better then other lectures out there on internet
@praveen.sharma6 жыл бұрын
Brilliant Teaching , absolute clearance of Concepts , Respect you Sir !
@tusharikas54473 жыл бұрын
when I asked my friends about int a[] and int *a being treated similarly. I realised they had no idea about it! Your videos are too good.
@SmartProgramming6 жыл бұрын
great explanation sir, lot of concepts has explained very well, helpful for students, thanks 👍👍
@mycodeschool11 жыл бұрын
Thanks a lot !
@ekta21095 жыл бұрын
In main method,2nd line- total = SumofElements(A); Here when we r using A then only base address will be passed as u told in previous lecture that using A means base address.. This is confusing me😣how whole array is being passed..how will we differentiate where only base address will be passed and where whole array..
@kalpanasharma6185 жыл бұрын
@@ekta2109 I have the same doubt!
@ashish39445 жыл бұрын
@@ekta2109 whole array is never passed. If you have the base address of the array with you then you can get the elements of the array simply by writing *(A+0), *(A+1), *(A+2) etc because the value stored in A is a memory location. To put it simply.....in order to have access to the whole array you just need to know the base address of that array(provided that you know the no. of elements in it).
@saumyojitdas42124 жыл бұрын
@@ashish3944 in this *(A+0) is A the pointer variable or array itself (A[]) as mentioned in the video when a pointer points to base adrres of array that pointer implicitly becomes an array . therefore in SOE function this statement is working sum=sum +A[i]; but at the same time in SOE there is no array there is a local pointer which points to a local array present in main func . THat means any pointer pointing to base adrres of array that *pointer implicitly becomes an array* .
@NoobsDeveloper2 жыл бұрын
Best every video watched in all the category of videos. Incredible!
@arjuntrivedi17714 жыл бұрын
Alot to learn from these lectures. Great stuff.👏👏👏
@eson30928 жыл бұрын
Thanks a lot. The array assigned to function is explained so well that I understand the tricky in one second.
@idmila8 жыл бұрын
AMAZING EXPLANATION, THANKS SO MUCH. I've already done so many tasks with arrays as function arguments but it was always somehow blurry to me why I do something or why I have to write it in a certain way. Thank you for clarifiying it in such a nice and systematic way! wow! simply impressive teaching skills!! :)
@sowmyakola47011 жыл бұрын
really u r doing awesome job.the best tutorials on c ,i hav ever seen.
@563woodcock10 жыл бұрын
you are a genius...better than professors with heavy degrees
@hetalpandya61376 жыл бұрын
Sir these lectures are really helping me.. Easy to understand and very helpful. My basics are cleared by watching the video..
@animeshnayan110 жыл бұрын
@Pine Drew: Yes, you need to pass the array size as extra parameter. This is a limitation for array only. In C, there is no other way, but in C++, you can use vectors (or other collection types in standard template library). An object of vector will basically be a dynamic array with length as one of its properties. So, you will not pass the length as extra parameter.
@bhargavchaitanya5 жыл бұрын
Why size is required as second argument??
@t.sathwik57083 жыл бұрын
this video cleared so many doubts regarding arrays as func.arguments
@osmm78487 жыл бұрын
man you're a legend ! my teacher fucked up in that size part and she had probblems in her programme .. And know because of u I understand this easly , Thanks a lot
@tarungupta682210 жыл бұрын
i really wanted to share it with you...you are the best teacher i have ever seen..i have studied your data structures series which were best ..with the help of those lectures i have completed my linked list project..so thnnkewww so much sir...The work you r doing is really ostentatious...
@azizas936610 жыл бұрын
Why don't be a professor ? You are very good at teaching Thanks
@mycodeschool10 жыл бұрын
I do not have the heavy degrees to become a professor :P
@AbhimanyuAryan10 жыл бұрын
mycodeschool does degree matters in getting a good job in India if one is extremely intelligent on computers? If a guy with a knowledge of all the programming languages but passing on margin in semester exams in a stupid college VS an IIT graduate with very limited knowledge....who will company prefer? I know about outside India but not in India...Indians put so much stress on marks over knowledge and excellence
@way2razerz10 жыл бұрын
Abhimanyu Aryan Well the one with IIT and low tech stuff is preferred, I guess. At least for competitive exams :)
@mycodeschool10 жыл бұрын
Abhimanyu Aryan Degree matters only if you want to take a governmet job. Matters elsewhere only as an initial filter. Industry has mertitocracy. Can't make a sweeping statement like "Indians put too much stress on marks".. I am Indian too and I never bothered to go to a class if the prof was boring even though it affected my grades :P
@saurabhbhandari63118 жыл бұрын
you dont need any degree sir because ur far better then them to explaining concept and by knowledge. And u r inspiration and as well as example that degree doesn't matter if we want be gain knowledge and get success.
@suigetsuhozuki14 жыл бұрын
Most important parts of this lecture: 7:21, 8:55
@vinalbagaria12036 жыл бұрын
You made me love my career as a computer engineer
@robgur858 жыл бұрын
Your explanations are so good!
@thestarinthesky_4 жыл бұрын
Thank you Animesh Nayan. Very helpful. You are amazing.
@onlystudy57335 жыл бұрын
I just love you. please keep going❤ I didn't start watching the video yet but I feel happy because I ask youtube question then directly find your unswer 😭big thumbs up 👍👍. Keep helping students ❤❤
@elonmust64733 жыл бұрын
Every useful and clear tutorial
@lamebrisee4 жыл бұрын
so clear and simple !! thanks a million :-)
@bdenix19972 жыл бұрын
I was literally wondering why size of the array i get was different when i passed it to a function, calling sizeof inside of that function. and i got the exact answer i was looking for. ty.
@md.ahmmed88113 жыл бұрын
The Hero we need but don't deserve
@animeshrastogi83152 жыл бұрын
Fantastic brother! Easy to understand.
@adolfocarrillo2485 жыл бұрын
This guy was incredible, He could explain everything really clear cause he really understood it deeply. I wish, he is getting the best in the other side. RIP my dear friend😥🍻
@Rajesh-bn5rw5 жыл бұрын
when he died?
@thestarinthesky_4 жыл бұрын
I guess his friend died. He is Animesh Nayan who is alive and working at Google, but his friend- co-founder of MyCodeSchool- passed away
@hasinanjum62824 жыл бұрын
No, he didn't die, the owner of this channel died. But he is not that person.
@hasinanjum62824 жыл бұрын
@@Rajesh-bn5rw NO he didn't die
@mycodeschool11 жыл бұрын
Thanks Sowmya !
@ABDULLAHAAK19 жыл бұрын
Tomorrow I have an exam and your videos are very helpful! thanks
@atharvas43996 жыл бұрын
could you do your line about sizeof in the function? also is the condition in for loop evaluated at every iteration of the loop. for eg usually we have a constant ( i < len ) but if its a function that does soemthing ( eg i < getLen() ) is it called after every loop?
@omaramin54868 жыл бұрын
Are there videos for types of user defined functions? i searched for types of user defined functions and i didn't find videos besides thanks for your efforts and really you are one of best programmer teaching this course . :)
@diegoalvarez23277 жыл бұрын
Congrats! Very nice explanation!! Can you please tell me if this logic applies also to an array of a structure and if so, is it possible to add the result (return) of a function as another element to the original structure after applying that function to every element of that array (loop)?
@dhirajmandal7154 жыл бұрын
Really very help full....thank u so so much 🔥👍👍
@vinayagarwal710 жыл бұрын
Your just amazing never thought it will be this much simple :)
@sdafsdaf48444 жыл бұрын
u still on youtube
@letsbeproductive76757 жыл бұрын
Excellent teaching,keep going bro,we expect more lectures from you on various technologies
@gopalpatil65516 жыл бұрын
You are excellent teacher....Thanks a lot.
@tonytran47549 жыл бұрын
I love your work. Very helpful. Keep it up.
@Aabara_ka_dabara Жыл бұрын
great lecture sir......
@563woodcock10 жыл бұрын
In SumOfElements(A), A can be written as &A which contains the address of the first element of array A, which is equal to 200. In function definition above, int SumOfElements(int A[]) can also be written as SumOfElements(int* A), here it is pointer to the first element of array A. That means it contains the value at address 200, not the address itself. Then how can you say that int* A contains 200 and not the value stored at 200?
@shanthgaitonde5 жыл бұрын
Because int* A passed in the function argument is pointer to integer which points to the address of the actual array. Dont get confused btwn dereferencing and pointer to integer concept.
@TheDaca234 жыл бұрын
Thank you very much! Best c tutorial on yt :D
@basaratali927 жыл бұрын
when you calling double function in main body. the function of Double(A, size) arguments pass first index value of array A and size or number elements array A. like that in array A 0 index value is 1 and size is 5. so we call the function in main Double(1, 5). and what did in the actual function body when you use the for loop. 1st indexing value of array A multiply with the 2. so in function body for loop 1 multiply with the 2 five time. when 1st time run loop 1*2 = 2. and 2 replace with 1. when loop goes on next indexing value, next index value in array is 2. again 2 multiply with second element of array. A[i] = 2*A[i]; 1st time run loop = A[0] = 2*1=2; 2nd time run loop = A[1] = 2*2=4; 3rd time run loop = A[2] = 2*3=6; 4th time run loop = A[3] = 2*4=8; 5th time run loop = A[4] = 2*5=10;
@bakihussain42314 жыл бұрын
Hi Sir, I have a question, In this video at 11:17, when u said A can be used for &A[0], I tried &A[1] to &A[6] and every time the value either went up or gave me a pointer value of something. I didn't understand why??
@rohitsutreja2 жыл бұрын
A ( the name of the array) point to first element i. e. A[0]. It does not point to A[2], A[3] etc.
@MohidShaikh44443 жыл бұрын
How are we passing "int size" as a function argument, in the 2nd last lecture previous to this lecture, it was shown how "a = 10" wasn't incremented when passed as value. Then how come "int size" is being passed here without any issue. I am a noob so any help is appreciated.
@bikdigdaddy2 жыл бұрын
hey! just wanted to add. in the 1st example in this video, he has used the function of the type so the call to the function will return the value while in the last second lecture, he used the function of the type void so in that video, we didn't’t get any return value. you can reply back, if you've already solved it or want more hlep.
@hvmall168 жыл бұрын
Thanks a lot. You make these tricky concepts look so easy. :)
@zayaerme3 жыл бұрын
Why can't we do dereferencing to *A in the SOE function if it is pointer to array element and find size of array from there?
@akashsarma71745 жыл бұрын
What compiler are you using? This looks cool.
@ajayguhan7 жыл бұрын
from where you learnt so much? amazing!
@seba235716 жыл бұрын
hello friend, one question. what type environment developed are you used in your videos?because i see while you written code in the ide, this go show error sintaxis in time of you go written design, that is before it will be compiled code. this is great.
@ShaliniNegi245 жыл бұрын
Thank you so much, Man! May you prosper :)
@Dev-zr8si5 жыл бұрын
He's dead. Died in an accident.
@AlbertoRivas135 жыл бұрын
This is very helpful man thanks a lot
@taymurahmed71199 жыл бұрын
Really you are the best teacher !!! Sir, do you have any projects about c++ ???
@PraddyumnShukla4 жыл бұрын
Can somebody explain me that how A[ ] in sumofelements( ) is able to store the copied elements of A[ ] from main if it's size is only 4 ?
@demonking31534 жыл бұрын
I think you are talking about sum+=A[i] here A[i] is same as *(A+i) A has address of first variable
@unnimayapavithran83308 жыл бұрын
You are too good Sir!!#withallrespect
@snehah16297 жыл бұрын
Thanks a lot sir, nice explanation of concepts.
@pierryangelo10 жыл бұрын
One thing I didn't understand, once you are passing an array by reference, so the argument A into the function increment is an address to the first position of the array A in the main function. Until there I understood, the things started to complicate because you are multiplying members of an array without using dereference operador like A[i] = 2 * A[i]; instead *A[i] = 2 * (*A[i]); why the logic is different when we deal with arrays? Thanks!
@mycodeschool10 жыл бұрын
When we are saying A[i], we have already de-referenced. A[i] is basically *(A+i). Watch this video for clarity: Pointers and arrays
@gan2ws10 жыл бұрын
mycodeschool he did say that when you are passing an array into another function, the compiler will automatically convert it to pointers. So even without this * symbol, the compiler will understand.
@baltatuandrei38368 жыл бұрын
+Pierry Ângelo Pereira Pointers and 1d arrays are similar,just that you can't modify an array name,because it is actually a const pointer. Also if you allocate an array using pointer p=new int[10], to get the value of a cell,you can either say p[i] or *(p+i). You can now see the similarities? I hope it helps. Take note that in higher dimension ,pointers and arrays are different in the way it stores the elements. That's why you can't put a static declared 2d array as a parameter to a function that looks like this f(int** p).
@naineshrathod23924 жыл бұрын
can anybody tell me which extensions to add in visual studio code in order to perform c & c++ programs
@overclockinggames24197 жыл бұрын
THANKS A LOT SIR , I LEARNED A LOT
@dank66177 жыл бұрын
So why do Arrays exist if everything can be expressed with pointer arithmetics as *(A+i)? Is it just a notational convenience or does it actually represent some other construct in the memory?
@alphabet_soup_696 жыл бұрын
#include using namespace std; void sumofelements(int *p, int *s){ *s += *p; } int main(){ int sum = 0; int A[]={1,2,3,4,5}; for(int i = 0; i < sizeof(A)/sizeof(A[0]); i++){ sumofelements(&A[i], &sum); } cout
@sanjeetagrawal97083 жыл бұрын
Excellent tutorial.
@meghna8889 жыл бұрын
sir,when im calculating size in main it's showing total size 20 and size of a[0] 4 which is correct,but when im calculating it in sumofelements its giving total size 8 and size of a[0] :4,why so?
@kathirkernel22869 жыл бұрын
+Meghna Rawat inside function even the declaration is like an array it almost woks as a pointer. basically sizeof(a) gives size of the pointer and the size of pointer is based on the operating system(32 bit or 64 bit). I think you are using 64 bit machine. so sizeof(a) returns 8 (bytes or 64 bit) inside the method.
@BlingSco7 жыл бұрын
I've been wondering why that was the case, please could u give sources and further documentation so I can understand it further. I've been searching for this answer for ages.
@BlingSco7 жыл бұрын
Yes I've tested this out myself a 32bit OS return 4 whereas a 64bit returns 8.
@shanthgaitonde5 жыл бұрын
The size of the pointer basically depends on the architecture of the system in which it is implemented. For example the size of a pointer in 32 bit is 4 bytes (32 bit ) and 8 bytes(64 bit ) in a 64 bit machines.
@_kahini7 жыл бұрын
what happens if initialize A[ ] in the function itself instead of the main function?
@appiahseth53194 жыл бұрын
wow. I've really understood the concept
@iverpunayan73085 жыл бұрын
how can I make the user input a number to my array and sum it up using Function?
@akshar176 жыл бұрын
hey , can you explain the algorithm for generating random numbers in programming languages???
@yuanwang98964 жыл бұрын
I have the SOE in function is size of a = 8 rather than 4. Does it mean my compiler assign a 64 bit RAM address to the pointer?
@achu46833 жыл бұрын
I am facing the same issue, did you get a solution to it?
@fardeenrazif93772 жыл бұрын
So when you pass arrays as function arguments, they are passed as pointer to integer
@divyambharti84198 жыл бұрын
hey i am a teenager and iwant to become a programmer and i have watched the introduction to programming through c and going on further on this i want you to recommend me a book so i can enhance my study program
@BhargabKakati8 жыл бұрын
Try Head First series to get started and interested.Good luck
@RoweroMacka9 жыл бұрын
#include int sumaelementow(int b[],int ciz) { int suma=0; for(int i=0;i
@alieser77706 жыл бұрын
what if I want to calculate the length of an array in a function in c?
@MMNayem-dq4kd2 жыл бұрын
You are a king😍
@akhil36289 жыл бұрын
sir u mentioned, that the SOE function only takes the address of &A[0] and derefenced it...Then how it is able to acceess remaining array elements ??.. u have used for loop for getting A[1] ,A[2]...... but array belonging to SOE didn't store all the remaining elemnts excpt &A[0]...
@vikramwaradpande50599 жыл бұрын
+Akhii 651 You copied address of the first element of the array, right? Now if you know the starting address, you know the addresses of the rest of the elements. This is because members of arrays are stored in consecutive memory locations. Hope this helps.
@elizabethtejada68347 жыл бұрын
How do I do if I want to print on screen three arrays using a function. I alredy did the function to display 3 arrays but I do not get to display them on the screen, I have a void function.
@hassanmajid41877 жыл бұрын
simply cout your arrays inside function argument
@differentperspective10005 жыл бұрын
yrr tu kitna awesome hai
@GKT1964 жыл бұрын
#include void Double(int* A, int size) { int i, sum = 0; for(i=0;i
@TheNiraj89908 жыл бұрын
You said A[ ] is basically the same as int *A, and I understand that, but SumOfElements only has the address of the first elements of the array, how does the for loop inside the SumOfElements work if the whole array is not mapped or passed to the SumOfElements. Does the pointer to the address of the first elements of the array increment every time when the for loop runs?
@yoongix49177 жыл бұрын
In the previous code, the size of the array is in the called function, and the loop wouldn't go more than 1 because it read the address of the first element. But when he put the size calculating in the calling function, size is counted within the stack frame, the incrementing can go over 1.
@hussameldinrabah50189 жыл бұрын
when i try 2 make it as a pointer, it gives me a compiler error either in dev or in codeblocks
@khayalipulao65888 жыл бұрын
Why does my compiler shows error when I write void double (int *A, int size) instead of void Double(int *A, int size)?? I m using Dev c++
@AmjithTitus7 жыл бұрын
Because 'double' is a keyword just like 'int' whereas 'Double' isn't. Cannot use keywords for names.
@ekta21095 жыл бұрын
In main method,2nd line- total = SumofElements(A); Here when we r using A then only base address will be passed as u told in previous lecture that using A means base address.. This is confusing me😣how whole array is being passed..how will we differentiate where only base address will be passed and where whole array..
@yarial8215 жыл бұрын
The array only being passed as the base address. And as mentioned in the video, A[i] is equivalent to *(A+1), which deference the memory address of A+1, we can get the value from the call function...Hope that helps :)
@basslinejunkies99765 жыл бұрын
2:03 what is size of one int????????????
@levi35352 ай бұрын
4 bytes (depends on architecture tho)
@aishwaryabhagwat96717 жыл бұрын
can anyone tell me where the return sum is used?is it even required? if yes how?
@jeswintobias8251 Жыл бұрын
who is watching it at 2023
@poisonza9 жыл бұрын
its an old video but, 1:35 sizeof is an operator.. not a function
@ebrobaaood76915 жыл бұрын
8:47 i think it's call by address!
@alexmathai19988 жыл бұрын
amazing video! Thanks so much
@sakibahmed43175 жыл бұрын
why int size =sizeof (A)/size of(A[0]) not work for in SumOfElements(*A )?
@tunamusic23144 жыл бұрын
@Peterolen I have a misunderstanding is that if we want to transfer all the array A[] into the function SumOfElements() what would we do? and why we make a line sumOfElements( A) then A is a pointer not an array, i dont understanding Can anyone help me with this? Thanks
@tunamusic23144 жыл бұрын
I have a misunderstanding is that if we want to transfer all the array A[] into the function SumOfElements() what would we do? and why we make a line sumOfElements( A) then A is a pointer not an array, i dont understanding Can anyone help me with this? Thanks