C_99 Returning Pointer from Function in C | C Language Tutorials

Поділитися
Вставка
  • Опубліковано 28 січ 2025

КОМЕНТАРІ • 76

  • @petereziagor4604
    @petereziagor4604 2 роки тому +11

    Quite tricky but you did justice to it.
    Thanks from Nigeria 🇳🇬

  • @Maddie05007
    @Maddie05007 Місяць тому +1

    11:24 BROOOO MIND BLOWN 🤯

  • @shikhapatro7427
    @shikhapatro7427 2 роки тому +6

    Superbly cleared concept!!! U just nailed it!!!! In love with ur sessions.....

  • @SandipBhattacharya
    @SandipBhattacharya 2 роки тому +6

    How to return anything from a C/C++ function like a string, or, array, int, or pointer. Please read on.
    Usually, a function can only return a single value, using the return mechanism. If you try to return more than one value from a function, only one value will be returned that appears at the rightmost place of the return statement. However, you can return multiple values from the function using the pointer, array, or structure.
    Using Pointers
    You can use pointers to return more than one value from a function by passing pointers as function parameters and use them to set multiple values which will then have visibility in the caller function.
    Using Array
    If you want to return multiple values of the same data type from a single function, then using an array is best suited because when an array name is passed as an argument then its base address is passed to the function so whatever changes made to the array is changed in the original array.
    Using Structure
    Another way to return multiple values from a function is by using structures. Structure is a user-defined datatype in C that can hold several datatypes of the same or different types. The idea is to create a structure variable containing all required data types as its members and return that from the function. We can then retrieve the values from the structure variable inside our caller function.

  • @nishyu9101
    @nishyu9101 2 роки тому +5

    This was a very important concept, thank you for covering this!

  • @arethelaabhilash9687
    @arethelaabhilash9687 2 роки тому +2

    Best channel for learning c language

  • @maheshk1865
    @maheshk1865 3 роки тому +3

    Love the way you teach 💐❤️❤️❤️

  • @gabbarjadhav2293
    @gabbarjadhav2293 3 роки тому +2

    thank you so muv\ch dear mam usefull for all those unable to pay......god bless you mam ....

  • @jyotirani8232
    @jyotirani8232 3 роки тому +4

    good evening mam. 🙏🙏

  • @avigupta9683
    @avigupta9683 3 роки тому +2

    Beautiful Concept cleared!..

  • @palanikanuu5847
    @palanikanuu5847 3 роки тому +1

    Very very thank you madam your video very very usefulness 🤗🤗🤗🤗🤗😊😊😊😊😇😇 I studied B.E cyber security and gate exam your videos for very useful Jenny madam

  • @Amanpreetkaur16
    @Amanpreetkaur16 3 роки тому +2

    You are amazing mam❤️❤️❤️❤️

  • @aparnamane4899
    @aparnamane4899 2 роки тому +1

    thank you mam.😊

  • @himanshu-x8s6b
    @himanshu-x8s6b 2 місяці тому

    thank you mam ji

  • @kausikkar2587
    @kausikkar2587 3 роки тому +5

    Ma'am, you are more consistent than Thugesh!😅

  • @rudrapatel48
    @rudrapatel48 3 роки тому +3

    Mam now we are a family of a half a million can you imagine all of us standing in front of you in a big ground or auditorium how would it feel like ???

  • @anuj_chaudhary_2430
    @anuj_chaudhary_2430 3 роки тому

    Waah ma'am aap bhut khoobsurat ho...

  • @SN-edits4u
    @SN-edits4u Рік тому +1

    If a is stored in stack memory of the returnPointer function then how it's not getting deleted when control is reaching out of this function

  • @ankithkumar4705
    @ankithkumar4705 3 роки тому +2

    Maam please start structures
    And unions 😀

  • @abdulrahimjalloh363
    @abdulrahimjalloh363 Рік тому

    Thanks mam

  • @gowthamselvaraj7793
    @gowthamselvaraj7793 Рік тому

    Do series similarly for java programming Mam

  • @jaijaijaijai123
    @jaijaijaijai123 4 місяці тому +1

    @10:42 since a is an array, a=a+2 statement gives error

  • @vanik2428
    @vanik2428 2 роки тому +2

    Hi mam,I have not clrafied y we cannot do a=a+2 , as per my understanding if we want to access the third element in array a we can do a[2],and other way may be a=a+2;
    if possible could you please give an example to get this

    • @himanu.verma_
      @himanu.verma_ 2 роки тому

      We can't do a=a+2 because here a is an internal pointer and is constant and it always points to the first value of array.
      In a[2] we access the address of 2nd index using that internal pointer and then we print the value at that address

    • @farzanaashraf8136
      @farzanaashraf8136 2 роки тому

      @@himanu.verma_ That is internal pointer local to the main function but in returnPointer that pointer is local to that function and we can do addition arithmetic on it.

    • @farzanaashraf8136
      @farzanaashraf8136 2 роки тому

      @@himanu.verma_ Yes we can print the value of a[2] in the returnPointer function and also in the main function.

  • @manjunathdesai5127
    @manjunathdesai5127 3 роки тому +3

    Which book is good for c beginning??

  • @NewGamer-do4jk
    @NewGamer-do4jk Рік тому

    But will returning a pointer be of any use since memory allocation to local variables of function will get deallocated after function exits , thus pointing to that location will be useless

  • @hitechaaso..5838
    @hitechaaso..5838 3 роки тому +7

    So in the series of c programming 🤣🤣🤣🤣🤣same line mam gjb

  • @pookkuttifamilyvlog6057
    @pookkuttifamilyvlog6057 3 роки тому +1

    Mam How can i join iam10th but i love this leaning

  • @muhammadwaseem7232
    @muhammadwaseem7232 3 роки тому

    Good evening mam

  • @MuddadaSameera
    @MuddadaSameera 4 місяці тому

    Mam, in declaration why we should write int* returnpointer instead of int returnpointer what is the difference in output?

    • @tanmay5070
      @tanmay5070 3 місяці тому

      if you write int, the function would return an integer type value (4 bytes on a 64 bit machine)
      and if you write int*, the function would return a pointer for int data type (8 bytes on a 64 bit machine)

    • @MuddadaSameera
      @MuddadaSameera 3 місяці тому

      What is the need of number of bytes?

    • @tanmay5070
      @tanmay5070 3 місяці тому

      @@MuddadaSameera well everything you store on the memory (ram) takes a certain amount of space (number of bits or bytes)
      one byte (B) = 8 bits (b).
      You might ask why do we even have to specify the int* or char* or something else? why can't we just use some other keyword for pointers to point at all types of data.
      The answer to that question is:
      remember I said int takes 4 B on a 64 bit machine and char takes 1 B on a 64 bit machine?
      suppose I made a pointer and it points at an int variable
      now, to dereference that pointer
      I need the base address and the amount of bytes to move forward from that base address to successfully fetch the value that the pointer is pointing to.
      for example:
      (0x1, 0x8, 0x10, 0x18) suppose these are the 4 bytes that collectively hold the integer (10) in its binary form.
      pointer would be initialized with 0x1
      to fetch 10 from those memory addresses, we need to move forward by 4 bytes
      how does the pointer know it has to move forward by 4 bytes? by the data type (int*)
      int* to move 4 bytes forward and fetch the value of all those bytes
      char* to fetch the value from the byte that it is currently pointing at (char takes 1B in a 64 bit machine)
      hope that helps :D
      ik it's a bit complex, but you'll get it!

    • @tanmay5070
      @tanmay5070 3 місяці тому

      @@MuddadaSameera yo man, idk if you can see my last comment, I wrote so many things in it. lemme know if you can

  • @emirhandemir3872
    @emirhandemir3872 2 роки тому +4

    VİDEO STARTS AT 2:40

  • @dangerousdesert
    @dangerousdesert 3 роки тому

    Good mam
    Love you mam

  • @TopRTelugu
    @TopRTelugu 3 роки тому +1

    Your my crush ma'am 😊☺️☺️☺️☺️🥰🥰🥰

  • @chiradeepbhattacharya1466
    @chiradeepbhattacharya1466 2 роки тому +1

    Maam then why you are not writing it as pointer in the function defination part ( int * p) you are writing it as (int a [ ]) why so.. please explain..?I have the screenshot to help you understand better my doubt but I cant upload it here due to non-availability of options

    • @hiriharanvm5568
      @hiriharanvm5568 8 місяців тому

      Hello bro... Greetings , as for ur doubt.... If int *p is used in definition then pointer would have only address and in this prmb we have used array a[ ].

  • @gabbarjadhav2293
    @gabbarjadhav2293 3 роки тому +1

    please upload c programming notes those written by you mam

  • @nomann5244
    @nomann5244 4 місяці тому

    we want a complete OOP playlist

  • @payelkumbhakar6337
    @payelkumbhakar6337 2 роки тому +1

    Why a is treated as a pointer here not as an array?

    • @farzanaashraf8136
      @farzanaashraf8136 2 роки тому

      Because the name of the array is the internal pointer to the base address of the array.

  • @khajamohiddinmohammed7992
    @khajamohiddinmohammed7992 3 роки тому

    Seventh comments heart plz🤗

  • @sanjanapanwar3844
    @sanjanapanwar3844 3 роки тому +1

    Ma'am please start core java 🥺

  • @Rajendra_Sen
    @Rajendra_Sen 3 роки тому +1

    First view

  • @tjayalakshmi5610
    @tjayalakshmi5610 3 роки тому +2

    Ma'am please send notes for us

  • @m.shivakumar2815
    @m.shivakumar2815 3 роки тому

    mam plzzz use high resolution camera

  • @selvaperumalcomputerinstru4181
    @selvaperumalcomputerinstru4181 3 роки тому +2

    Madam I need tamilnadu computer trb exam MCQ

  • @coding.with.student
    @coding.with.student 10 місяців тому

    😍

  • @Rajendra_Sen
    @Rajendra_Sen 3 роки тому +1

    First comment

  • @manjunathdesai5127
    @manjunathdesai5127 3 роки тому

    Mam which book is Good for begginer in c

  • @sachinlodhi7978
    @sachinlodhi7978 3 роки тому

    Can also find mam ji

  • @govindarao331
    @govindarao331 3 роки тому +1

    ❤❤❤😘

  • @HimanshuPuri-sz5ps
    @HimanshuPuri-sz5ps 3 місяці тому

    mam please use vs code in dark mode

  • @sunnysingh-ms1fx
    @sunnysingh-ms1fx 3 роки тому +2

    Course fees please

  • @black_motivation4344
    @black_motivation4344 3 роки тому +1

    Everyone is first here
    Until they refresh 😂😂😂😂😂

  • @sunnysingh-ms1fx
    @sunnysingh-ms1fx 3 роки тому

    Hello mam

  • @riyagupta1841
    @riyagupta1841 3 роки тому

    Second view

  • @ishajain6833
    @ishajain6833 3 роки тому

    Mam please make video on how to run programmes in laptop because I am begginer plz mam

  • @reyazmir9259
    @reyazmir9259 Рік тому

    Your voice Is so cute

  • @anujeetkunturkar780
    @anujeetkunturkar780 3 роки тому

    Skip 0:56 to 2:33

  • @Aakritisingh04444
    @Aakritisingh04444 3 роки тому

    apne unacademy ka advertisement krne ke kitne rupay liye hai???