Arrays as function arguments

  Рет қаралды 379,764

mycodeschool

mycodeschool

Күн бұрын

Пікірлер: 241
@AlyMabrouk2012
@AlyMabrouk2012 3 жыл бұрын
even after 8 years ,these tutorials are still masterpiece
@greagarious44
@greagarious44 11 жыл бұрын
I m a Masters Student and I must say that your tutorials are highly professional and clear. Your channel is a must watch !!
@turing_machine544
@turing_machine544 4 жыл бұрын
He is a legend ..watching in 2020 (1st year college student)
@Razvi
@Razvi 8 жыл бұрын
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-v8o
@row-v8o 2 жыл бұрын
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
@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!
@leixun
@leixun 4 жыл бұрын
*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
@mehulsaini9645
@mehulsaini9645 4 жыл бұрын
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; } //////
@gamoholic7653
@gamoholic7653 3 жыл бұрын
@@mehulsaini9645 int* a equals to int[a] was only valid for formal parameter not as a return type..
@MohitSingh-om8jt
@MohitSingh-om8jt 5 жыл бұрын
Absolutely incredible. Never thought pointers could be taught so gracefully
@ahmedsamy-lc1ux
@ahmedsamy-lc1ux 8 ай бұрын
11 years later and this is still Legend👐
@shivamverma9447
@shivamverma9447 4 жыл бұрын
This video of 13min will clear all your doubts........This teacher is just amazing.....
@BL4S7ER
@BL4S7ER 11 жыл бұрын
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.
@vigneshmanoharan3770
@vigneshmanoharan3770 9 жыл бұрын
For those of you working in 64 bit OS, the size of pointer would be 8, instead of 4 as shown in video.
@hussameldinrabah5018
@hussameldinrabah5018 9 жыл бұрын
+Vignesh Manoharan in dev c++ compiler, we have 8 bytes int .. in Codeblocks, 4 bytes >> my laptop is 64 bit OS
@saurabhkumarjha4996
@saurabhkumarjha4996 6 жыл бұрын
he is stupid bro
@adrijabose4598
@adrijabose4598 4 жыл бұрын
Ya thanks I had this confusion
@mrlegend3983
@mrlegend3983 2 жыл бұрын
Thanks bhai
@youssefandroid6512
@youssefandroid6512 8 жыл бұрын
سبحان الله الله يجزيك بالخير اخي مشاء الله شرح راءع الله يجعله في ميزان حسنتك
@codekarlebhai
@codekarlebhai Жыл бұрын
watching in 2023, still relevant and far better then other lectures out there on internet
@praveen.sharma
@praveen.sharma 6 жыл бұрын
Brilliant Teaching , absolute clearance of Concepts , Respect you Sir !
@tusharikas5447
@tusharikas5447 3 жыл бұрын
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.
@SmartProgramming
@SmartProgramming 6 жыл бұрын
great explanation sir, lot of concepts has explained very well, helpful for students, thanks 👍👍
@mycodeschool
@mycodeschool 11 жыл бұрын
Thanks a lot !
@ekta2109
@ekta2109 5 жыл бұрын
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..
@kalpanasharma618
@kalpanasharma618 5 жыл бұрын
@@ekta2109 I have the same doubt!
@ashish3944
@ashish3944 5 жыл бұрын
@@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).
@saumyojitdas4212
@saumyojitdas4212 4 жыл бұрын
@@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* .
@NoobsDeveloper
@NoobsDeveloper 2 жыл бұрын
Best every video watched in all the category of videos. Incredible!
@arjuntrivedi1771
@arjuntrivedi1771 4 жыл бұрын
Alot to learn from these lectures. Great stuff.👏👏👏
@eson3092
@eson3092 8 жыл бұрын
Thanks a lot. The array assigned to function is explained so well that I understand the tricky in one second.
@idmila
@idmila 8 жыл бұрын
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!! :)
@sowmyakola470
@sowmyakola470 11 жыл бұрын
really u r doing awesome job.the best tutorials on c ,i hav ever seen.
@563woodcock
@563woodcock 10 жыл бұрын
you are a genius...better than professors with heavy degrees
@hetalpandya6137
@hetalpandya6137 6 жыл бұрын
Sir these lectures are really helping me.. Easy to understand and very helpful. My basics are cleared by watching the video..
@animeshnayan1
@animeshnayan1 10 жыл бұрын
@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.
@bhargavchaitanya
@bhargavchaitanya 5 жыл бұрын
Why size is required as second argument??
@t.sathwik5708
@t.sathwik5708 3 жыл бұрын
this video cleared so many doubts regarding arrays as func.arguments
@osmm7848
@osmm7848 7 жыл бұрын
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
@tarungupta6822
@tarungupta6822 10 жыл бұрын
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...
@azizas9366
@azizas9366 10 жыл бұрын
Why don't be a professor ? You are very good at teaching Thanks
@mycodeschool
@mycodeschool 10 жыл бұрын
I do not have the heavy degrees to become a professor :P
@AbhimanyuAryan
@AbhimanyuAryan 10 жыл бұрын
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
@way2razerz
@way2razerz 10 жыл бұрын
Abhimanyu Aryan Well the one with IIT and low tech stuff is preferred, I guess. At least for competitive exams :)
@mycodeschool
@mycodeschool 10 жыл бұрын
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
@saurabhbhandari6311
@saurabhbhandari6311 8 жыл бұрын
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.
@suigetsuhozuki1
@suigetsuhozuki1 4 жыл бұрын
Most important parts of this lecture: 7:21, 8:55
@vinalbagaria1203
@vinalbagaria1203 6 жыл бұрын
You made me love my career as a computer engineer
@robgur85
@robgur85 8 жыл бұрын
Your explanations are so good!
@thestarinthesky_
@thestarinthesky_ 4 жыл бұрын
Thank you Animesh Nayan. Very helpful. You are amazing.
@onlystudy5733
@onlystudy5733 5 жыл бұрын
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 ❤❤
@elonmust6473
@elonmust6473 3 жыл бұрын
Every useful and clear tutorial
@lamebrisee
@lamebrisee 4 жыл бұрын
so clear and simple !! thanks a million :-)
@bdenix1997
@bdenix1997 2 жыл бұрын
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.ahmmed8811
@md.ahmmed8811 3 жыл бұрын
The Hero we need but don't deserve
@animeshrastogi8315
@animeshrastogi8315 2 жыл бұрын
Fantastic brother! Easy to understand.
@adolfocarrillo248
@adolfocarrillo248 5 жыл бұрын
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-bn5rw
@Rajesh-bn5rw 5 жыл бұрын
when he died?
@thestarinthesky_
@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
@hasinanjum6282
@hasinanjum6282 4 жыл бұрын
No, he didn't die, the owner of this channel died. But he is not that person.
@hasinanjum6282
@hasinanjum6282 4 жыл бұрын
@@Rajesh-bn5rw NO he didn't die
@mycodeschool
@mycodeschool 11 жыл бұрын
Thanks Sowmya !
@ABDULLAHAAK1
@ABDULLAHAAK1 9 жыл бұрын
Tomorrow I have an exam and your videos are very helpful! thanks
@atharvas4399
@atharvas4399 6 жыл бұрын
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?
@omaramin5486
@omaramin5486 8 жыл бұрын
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 . :)
@diegoalvarez2327
@diegoalvarez2327 7 жыл бұрын
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)?
@dhirajmandal715
@dhirajmandal715 4 жыл бұрын
Really very help full....thank u so so much 🔥👍👍
@vinayagarwal7
@vinayagarwal7 10 жыл бұрын
Your just amazing never thought it will be this much simple :)
@sdafsdaf4844
@sdafsdaf4844 4 жыл бұрын
u still on youtube
@letsbeproductive7675
@letsbeproductive7675 7 жыл бұрын
Excellent teaching,keep going bro,we expect more lectures from you on various technologies
@gopalpatil6551
@gopalpatil6551 6 жыл бұрын
You are excellent teacher....Thanks a lot.
@tonytran4754
@tonytran4754 9 жыл бұрын
I love your work. Very helpful. Keep it up.
@Aabara_ka_dabara
@Aabara_ka_dabara Жыл бұрын
great lecture sir......
@563woodcock
@563woodcock 10 жыл бұрын
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?
@shanthgaitonde
@shanthgaitonde 5 жыл бұрын
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.
@TheDaca23
@TheDaca23 4 жыл бұрын
Thank you very much! Best c tutorial on yt :D
@basaratali92
@basaratali92 7 жыл бұрын
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;
@bakihussain4231
@bakihussain4231 4 жыл бұрын
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??
@rohitsutreja
@rohitsutreja 2 жыл бұрын
A ( the name of the array) point to first element i. e. A[0]. It does not point to A[2], A[3] etc.
@MohidShaikh4444
@MohidShaikh4444 3 жыл бұрын
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.
@bikdigdaddy
@bikdigdaddy 2 жыл бұрын
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.
@hvmall16
@hvmall16 8 жыл бұрын
Thanks a lot. You make these tricky concepts look so easy. :)
@zayaerme
@zayaerme 3 жыл бұрын
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?
@akashsarma7174
@akashsarma7174 5 жыл бұрын
What compiler are you using? This looks cool.
@ajayguhan
@ajayguhan 7 жыл бұрын
from where you learnt so much? amazing!
@seba23571
@seba23571 6 жыл бұрын
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.
@ShaliniNegi24
@ShaliniNegi24 5 жыл бұрын
Thank you so much, Man! May you prosper :)
@Dev-zr8si
@Dev-zr8si 5 жыл бұрын
He's dead. Died in an accident.
@AlbertoRivas13
@AlbertoRivas13 5 жыл бұрын
This is very helpful man thanks a lot
@taymurahmed7119
@taymurahmed7119 9 жыл бұрын
Really you are the best teacher !!! Sir, do you have any projects about c++ ???
@PraddyumnShukla
@PraddyumnShukla 4 жыл бұрын
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 ?
@demonking3153
@demonking3153 4 жыл бұрын
I think you are talking about sum+=A[i] here A[i] is same as *(A+i) A has address of first variable
@unnimayapavithran8330
@unnimayapavithran8330 8 жыл бұрын
You are too good Sir!!#withallrespect
@snehah1629
@snehah1629 7 жыл бұрын
Thanks a lot sir, nice explanation of concepts.
@pierryangelo
@pierryangelo 10 жыл бұрын
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!
@mycodeschool
@mycodeschool 10 жыл бұрын
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
@gan2ws
@gan2ws 10 жыл бұрын
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.
@baltatuandrei3836
@baltatuandrei3836 8 жыл бұрын
+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).
@naineshrathod2392
@naineshrathod2392 4 жыл бұрын
can anybody tell me which extensions to add in visual studio code in order to perform c & c++ programs
@overclockinggames2419
@overclockinggames2419 7 жыл бұрын
THANKS A LOT SIR , I LEARNED A LOT
@dank6617
@dank6617 7 жыл бұрын
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_69
@alphabet_soup_69 6 жыл бұрын
#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
@sanjeetagrawal9708
@sanjeetagrawal9708 3 жыл бұрын
Excellent tutorial.
@meghna888
@meghna888 9 жыл бұрын
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?
@kathirkernel2286
@kathirkernel2286 9 жыл бұрын
+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.
@BlingSco
@BlingSco 7 жыл бұрын
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.
@BlingSco
@BlingSco 7 жыл бұрын
Yes I've tested this out myself a 32bit OS return 4 whereas a 64bit returns 8.
@shanthgaitonde
@shanthgaitonde 5 жыл бұрын
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.
@_kahini
@_kahini 7 жыл бұрын
what happens if initialize A[ ] in the function itself instead of the main function?
@appiahseth5319
@appiahseth5319 4 жыл бұрын
wow. I've really understood the concept
@iverpunayan7308
@iverpunayan7308 5 жыл бұрын
how can I make the user input a number to my array and sum it up using Function?
@akshar17
@akshar17 6 жыл бұрын
hey , can you explain the algorithm for generating random numbers in programming languages???
@yuanwang9896
@yuanwang9896 4 жыл бұрын
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?
@achu4683
@achu4683 3 жыл бұрын
I am facing the same issue, did you get a solution to it?
@fardeenrazif9377
@fardeenrazif9377 2 жыл бұрын
So when you pass arrays as function arguments, they are passed as pointer to integer
@divyambharti8419
@divyambharti8419 8 жыл бұрын
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
@BhargabKakati
@BhargabKakati 8 жыл бұрын
Try Head First series to get started and interested.Good luck
@RoweroMacka
@RoweroMacka 9 жыл бұрын
#include int sumaelementow(int b[],int ciz) { int suma=0; for(int i=0;i
@alieser7770
@alieser7770 6 жыл бұрын
what if I want to calculate the length of an array in a function in c?
@MMNayem-dq4kd
@MMNayem-dq4kd 2 жыл бұрын
You are a king😍
@akhil3628
@akhil3628 9 жыл бұрын
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]...
@vikramwaradpande5059
@vikramwaradpande5059 9 жыл бұрын
+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.
@elizabethtejada6834
@elizabethtejada6834 7 жыл бұрын
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.
@hassanmajid4187
@hassanmajid4187 7 жыл бұрын
simply cout your arrays inside function argument
@differentperspective1000
@differentperspective1000 5 жыл бұрын
yrr tu kitna awesome hai
@GKT196
@GKT196 4 жыл бұрын
#include void Double(int* A, int size) { int i, sum = 0; for(i=0;i
@TheNiraj8990
@TheNiraj8990 8 жыл бұрын
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?
@yoongix4917
@yoongix4917 7 жыл бұрын
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.
@hussameldinrabah5018
@hussameldinrabah5018 9 жыл бұрын
when i try 2 make it as a pointer, it gives me a compiler error either in dev or in codeblocks
@khayalipulao6588
@khayalipulao6588 8 жыл бұрын
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++
@AmjithTitus
@AmjithTitus 7 жыл бұрын
Because 'double' is a keyword just like 'int' whereas 'Double' isn't. Cannot use keywords for names.
@ekta2109
@ekta2109 5 жыл бұрын
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..
@yarial821
@yarial821 5 жыл бұрын
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 :)
@basslinejunkies9976
@basslinejunkies9976 5 жыл бұрын
2:03 what is size of one int????????????
@levi3535
@levi3535 2 ай бұрын
4 bytes (depends on architecture tho)
@aishwaryabhagwat9671
@aishwaryabhagwat9671 7 жыл бұрын
can anyone tell me where the return sum is used?is it even required? if yes how?
@jeswintobias8251
@jeswintobias8251 Жыл бұрын
who is watching it at 2023
@poisonza
@poisonza 9 жыл бұрын
its an old video but, 1:35 sizeof is an operator.. not a function
@ebrobaaood7691
@ebrobaaood7691 5 жыл бұрын
8:47 i think it's call by address!
@alexmathai1998
@alexmathai1998 8 жыл бұрын
amazing video! Thanks so much
@sakibahmed4317
@sakibahmed4317 5 жыл бұрын
why int size =sizeof (A)/size of(A[0]) not work for in SumOfElements(*A )?
@tunamusic2314
@tunamusic2314 4 жыл бұрын
​@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
@tunamusic2314
@tunamusic2314 4 жыл бұрын
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
Character arrays and pointers - part 1
14:41
mycodeschool
Рет қаралды 551 М.
Pointers as function arguments - call by reference
14:16
mycodeschool
Рет қаралды 489 М.
How Many Balloons To Make A Store Fly?
00:22
MrBeast
Рет қаралды 198 МЛН
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 41 МЛН
Каха и дочка
00:28
К-Media
Рет қаралды 3,3 МЛН
Pointers as function returns in C/C++
15:15
mycodeschool
Рет қаралды 281 М.
Pointers and dynamic memory - stack vs heap
17:26
mycodeschool
Рет қаралды 1,5 МЛН
Passing an Array to a Function | C Programming Tutorial
9:30
Portfolio Courses
Рет қаралды 45 М.
Pointers and multidimensional arrays
16:45
mycodeschool
Рет қаралды 246 М.
you will never ask about pointers again after watching this video
8:03
Function pointers and callbacks
15:19
mycodeschool
Рет қаралды 337 М.
Using Arrays with For Loops
17:24
Programming Electronics Academy
Рет қаралды 34 М.
Functions won’t eat arrays whole - Do this simple thing instead!
8:10
Programming Electronics Academy
Рет қаралды 12 М.
Master Pointers in C:  10X Your C Coding!
14:12
Dave's Garage
Рет қаралды 334 М.
How Many Balloons To Make A Store Fly?
00:22
MrBeast
Рет қаралды 198 МЛН