Hello Wisdomers, this course is the old version. The teacher you trust has made a brand new, even better version for you. For Complete Playlist Click here to watch it. • C Programming
Pointers as function Arguments
In this class, we will understand the use of Pointers as function Arguments.
We have clearly understood the concepts of pointer variables and the visualization of pointers.
Pointers as function Arguments
So far, we have understood what pointers are, but we haven’t understood the use of pointers.
There are many uses of the pointers in c programming.
One of the important use of pointers is passing them as the function arguments.
We will try to understand the use of passing the arguments of the functions as pointers using the swapping the values of a variable example.
The image below shows the use of arguments as values, NOT as pointers.
The objective above program is to swap the values of i and j.
As we pass the values of arguments as values in the swap function, i and j will get assigned to x and y.
With this assignment, we will lose the connectivity of ‘i’ and j.
The swap function will swap the values of x and y but not the i and j.
With this way of function call, we can not swap the values of i and j.
The image below is the program for swapping the values with arguments as address.
In the above program, the swap function calls have the address of the variables i and j.
In the function definition, the parameters x and y are the pointers to store the ‘address of’ variables i and j.
Now the swap function swaps the values i and j as we pass the references of the variables i and j.
#learningmonkey #cprogrammingforbeginners #placements #gatecse #cprogramming #cprogramminglanguage
Link for playlists:
/ @wisdomerscse
Link for our website: https://learningmonkey.in
Follow us on Facebook @ / learningmonkey
Follow us on Instagram @ / learningmonkey1
Follow us on Twitter @ / _learningmonkey
Mail us @ learningmonkey01@gmail.com
In questa pagina del sito puoi guardare il video online [OLD VERSION] Pointers as function Arguments || Lesson 62 || C Programming || Learning Monkey || della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Wisdomers - Computer Science and Engineering 19 luglio 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 11,576 volte e gli è piaciuto 240 spettatori. Buona visione!