C_99 Returning Pointer from Function in C | C Language Tutorials

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ม.ค. 2025

ความคิดเห็น • 78

  • @Maddie05007
    @Maddie05007 หลายเดือนก่อน +1

    11:24 BROOOO MIND BLOWN 🤯

  • @petereziagor4604
    @petereziagor4604 2 ปีที่แล้ว +11

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

  • @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.

  • @shikhapatro7427
    @shikhapatro7427 2 ปีที่แล้ว +6

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

  • @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 💐❤️❤️❤️

  • @jyotirani8232
    @jyotirani8232 3 ปีที่แล้ว +4

    good evening mam. 🙏🙏

  • @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

  • @gabbarjadhav2293
    @gabbarjadhav2293 3 ปีที่แล้ว +2

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

  • @avigupta9683
    @avigupta9683 2 ปีที่แล้ว +2

    Beautiful Concept cleared!..

  • @Amanpreetkaur16
    @Amanpreetkaur16 3 ปีที่แล้ว +2

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

  • @kausikkar2587
    @kausikkar2587 3 ปีที่แล้ว +5

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

  • @himanshu-x8s6b
    @himanshu-x8s6b หลายเดือนก่อน

    thank you mam ji

  • @aparnamane4899
    @aparnamane4899 2 ปีที่แล้ว +1

    thank you mam.😊

  • @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 😀

  • @TopRTelugu
    @TopRTelugu 3 ปีที่แล้ว +1

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

  • @hitechaaso..5838
    @hitechaaso..5838 3 ปีที่แล้ว +7

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

  • @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.

  • @abdulrahimjalloh363
    @abdulrahimjalloh363 ปีที่แล้ว

    Thanks mam

  • @jaijaijaijai123
    @jaijaijaijai123 3 หลายเดือนก่อน +1

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

  • @gowthamselvaraj7793
    @gowthamselvaraj7793 ปีที่แล้ว

    Do series similarly for java programming Mam

  • @emirhandemir3872
    @emirhandemir3872 2 ปีที่แล้ว +4

    VİDEO STARTS AT 2:40

  • @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

  • @muhammadwaseem7232
    @muhammadwaseem7232 3 ปีที่แล้ว

    Good evening mam

  • @pookkuttifamilyvlog6057
    @pookkuttifamilyvlog6057 3 ปีที่แล้ว +1

    Mam How can i join iam10th but i love this leaning

  • @manjunathdesai5127
    @manjunathdesai5127 3 ปีที่แล้ว +3

    Which book is good for c beginning??

  • @MuddadaSameera
    @MuddadaSameera 4 หลายเดือนก่อน

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

    • @tanmay5070
      @tanmay5070 2 หลายเดือนก่อน

      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 2 หลายเดือนก่อน

      What is the need of number of bytes?

    • @tanmay5070
      @tanmay5070 2 หลายเดือนก่อน

      @@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 2 หลายเดือนก่อน

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

  • @dangerousdesert
    @dangerousdesert 3 ปีที่แล้ว

    Good mam
    Love you mam

  • @sanjanapanwar3844
    @sanjanapanwar3844 3 ปีที่แล้ว +2

    Ma'am please start core java 🥺

  • @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 7 หลายเดือนก่อน

      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

  • @black_motivation4344
    @black_motivation4344 3 ปีที่แล้ว +1

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

  • @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 9 หลายเดือนก่อน

    😍

  • @tjayalakshmi5610
    @tjayalakshmi5610 3 ปีที่แล้ว +2

    Ma'am please send notes for us

  • @manjunathdesai5127
    @manjunathdesai5127 3 ปีที่แล้ว

    Mam which book is Good for begginer in c

  • @govindarao331
    @govindarao331 3 ปีที่แล้ว +1

    ❤❤❤😘

  • @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🤗

  • @sunnysingh-ms1fx
    @sunnysingh-ms1fx 3 ปีที่แล้ว +2

    Course fees please

  • @Rajendra_Sen
    @Rajendra_Sen 3 ปีที่แล้ว +1

    First view

  • @HarishKumarNamballa
    @HarishKumarNamballa หลายเดือนก่อน

    mam do java also pls .....

    • @JennyslecturesCSIT
      @JennyslecturesCSIT  หลายเดือนก่อน

      Already started a new course on Java +DSA.. u can check out here: www.jennyslectures.com/courses/Mastering-Data-Structures-and-Algorithms-with-JAVA-66d7fe06b4f7fa3fb969f5c5

  • @Rajendra_Sen
    @Rajendra_Sen 3 ปีที่แล้ว +1

    First comment

  • @sachinlodhi7978
    @sachinlodhi7978 3 ปีที่แล้ว

    Can also find mam ji

  • @HimanshuPuri-sz5ps
    @HimanshuPuri-sz5ps 2 หลายเดือนก่อน

    mam please use vs code in dark mode

  • @anujeetkunturkar780
    @anujeetkunturkar780 3 ปีที่แล้ว

    Skip 0:56 to 2:33

  • @reyazmir9259
    @reyazmir9259 ปีที่แล้ว

    Your voice Is so cute

  • @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

  • @Aakritisingh04444
    @Aakritisingh04444 3 ปีที่แล้ว

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