Passing Array as an Argument to a Function

Passing Array as an Argument to a Function

Neso Academy

5 лет назад

268,490 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Lokesh
Lokesh - 22.08.2023 21:53

thanks

Ответить
Sakshssy_1
Sakshssy_1 - 01.07.2023 10:43

tip 2: But we cannot perform the operation b++ in the function add(). In the add function, if the parameter b is declared as int b[], you cannot perform pointer arithmetic operations like b++ directly on the array parameter itself. This is because, in the function signature int add(int b[], int len), b is treated as a pointer to the first element of the array, and not as an actual array.

If you need to perform pointer arithmetic or modify the pointer itself within the function, you should declare the parameter as int *b instead. This allows you to manipulate the pointer b using operations like b++, b+1, etc., which would not be possible if b is declared as int b[].

Ответить
Sakshssy_1
Sakshssy_1 - 01.07.2023 10:40

tip: when you define a function parameter as an array, like int b[], it is treated as a pointer to the first element of the array. So, int b[] and int *b in the function definition are interchangeable.

Ответить
Hikari
Hikari - 20.06.2023 05:34

Hi sir i wacthed your too mach electronic and you saved my ass too many time

But i wanna tell you that its not arey and array and you can you strlen() function for length

Ответить
KG LEGENDS
KG LEGENDS - 29.05.2023 16:53

Sir your video are nice and to the point

Ответить
BIRENDRA KUMAR SINGH
BIRENDRA KUMAR SINGH - 25.03.2023 22:32

finally got the concept sir , thanks

Ответить
Tornado-Zex
Tornado-Zex - 27.02.2023 11:35

great explaining thank you sir

Ответить
Abir Kolin
Abir Kolin - 13.11.2022 19:58

thank you so much

Ответить
PLAY
PLAY - 23.09.2022 16:12

awsm explanation on the topic its such a complex topic but we all got it

Ответить
Aditya Patil
Aditya Patil - 20.09.2022 22:36

sir how is *b[ ] and b[ ] are same

Ответить
ayush roy
ayush roy - 06.07.2022 17:47

thank you for keeping it short, it was exactly what I needed

Ответить
Sindhu Nayak
Sindhu Nayak - 27.01.2022 06:37

In the previous quiz you said C uses pass by value by default. But array uses pass by reference by default. So Answer should be "both" then

Ответить
Govt.bankaspirantlife
Govt.bankaspirantlife - 17.12.2021 19:49

usually i dont comment , but the effort and the way your explaining is OP . lots of love and I wish you have a beatufil and lovely life with all the blessings of your family(subscribers)😍

Ответить
Chandupatla Aditya
Chandupatla Aditya - 15.12.2021 18:10

If anyone watching this video and understood plzz answer my question:
If b[] is an array storing address then it should be termed as int *b[] as it is storing adrress.

Ответить
Mehmet Çetinkaya
Mehmet Çetinkaya - 02.12.2021 10:02

i cant understand your grammar

Ответить
Ashish Kumar
Ashish Kumar - 19.11.2021 14:11

Is this dynamic memory allocation? We have not given the size of array b. Will it take the same size of array a? Plz reply

Ответить
Angus Mackintosh
Angus Mackintosh - 10.11.2021 22:08

who is out here passing grinding for finals?

Ответить
SIDDHARTH PATWAL
SIDDHARTH PATWAL - 21.10.2021 16:14

I have a doubt that if b is a pointer then what does b[ i ] means because b is now a pointer and then what does these square bracket means I.e b[ i ]

Ответить
Rashila Lamichhane
Rashila Lamichhane - 14.09.2021 14:11

Thank you soo much !!

Ответить
Om Gaikwad
Om Gaikwad - 30.08.2021 11:32

Sir from the pointers topic you are going quite fast. For slow learners like me it's somewhat difficult to catch up with you. Hope you understand.

Ответить
Funny animation
Funny animation - 04.07.2021 15:10

This academy make the perfect vedio on every topic not wasting the time even for a moments

Ответить
Worlds Hello
Worlds Hello - 30.06.2021 05:07

This video does not support subtitles. How do I turn it on?

Ответить
AYUSHI PRIYA
AYUSHI PRIYA - 19.06.2021 20:15

Thank u so much sir
Mujhe y concept samajh nhi aa raha tha but ab aa gya

Ответить
Sadiq Khan
Sadiq Khan - 19.05.2021 07:34

Sir, Could you please make a tutorial on javascript, Thank you!

Ответить
Chama Hge
Chama Hge - 17.05.2021 12:18

int add(int b[],int len)
above is same as below

int add(int *b,int len)

Ответить
Daniel Soares
Daniel Soares - 16.03.2021 07:54

to pass address you would have to put &a to pass the base address.

Ответить
Sadiq Khan
Sadiq Khan - 18.02.2021 14:24

Thank you so much sir.
I had confusion in this topic since a while but now you cleared my head out of confusion.

Ответить
Calebe Lino
Calebe Lino - 07.02.2021 20:44

What if I wanna pass a matrix?

Ответить
Chirag
Chirag - 17.01.2021 12:36

how to pass array if we are taking input via scanf()

Ответить
kilips
kilips - 14.12.2020 23:41

if the array name points to the first location only then how sizeof(<array name>) returns the total size of the array?

Ответить
Ray
Ray - 10.12.2020 20:44

Why doesn't a have an * or & associated with it, also why don;t you declare a pointer variable? thanks

Ответить
Guna Shankar
Guna Shankar - 27.11.2020 08:29

How can we declare (int b[],int len) in the main function and how we write anything in the barces

Ответить
Jake Steinmetz
Jake Steinmetz - 09.07.2020 01:08

Thank you! This video is great!

Ответить
Shikha Jain
Shikha Jain - 07.07.2020 07:45

i hv written the same code in code blocks, but i m getting output as 1 that means it is just giving output as just first element and not the sum ..please help

Ответить
safia khan
safia khan - 17.05.2020 18:59

can we put an expression inside the square brackets of an array

Ответить
Nikhil Anand
Nikhil Anand - 10.05.2020 22:07

sir I am unable to get the correct sum instead getting some random integer as output. I had written the program as such. Really disappointed with your codes. Please address to my issue.

Ответить
Sagar Nanda
Sagar Nanda - 07.05.2020 18:38

Arrey sir nice explaination

Ответить
Tima
Tima - 03.05.2020 14:23

Oh, b[ ] means is like a pointer *b

Ответить
Shivanand P
Shivanand P - 26.03.2020 15:29

Thanks for the video . It's Soo easy ❤️❤️

Ответить
Satya Prakash
Satya Prakash - 20.03.2020 13:15

Sir but here you waste a full array memory in function

Ответить
Aditya Saxena
Aditya Saxena - 26.12.2019 09:34

int add(int b[],int len)
is above same as below as used in video for function definition first line?
int add(int *b,int len)

Ответить
Akarsh Khandelwal
Akarsh Khandelwal - 23.11.2019 17:31

Sir,how can int b[ ]=int *b

Ответить
Shashidhara.G.M
Shashidhara.G.M - 20.11.2019 16:29

THANK YOU SO MUCH

Ответить
Dario Gabriel
Dario Gabriel - 15.10.2019 23:21

you are the best thank u so much

Ответить
Rahul Patil
Rahul Patil - 21.09.2019 09:43

What a explanation thanks sir

Ответить
umair alvi
umair alvi - 15.07.2019 13:38

But we cannot perform the operation b++ in the function add().

Ответить
rudra singh
rudra singh - 12.06.2019 20:45

Sir can u plz upload same course for C++ as well

Ответить