Function Pointers In C

Sdílet
Vložit
  • čas přidán 29. 08. 2024

Komentáře • 62

  • @aman7492
    @aman7492 Před 6 lety +8

    One of the best usage of function pointers is in setting up the environment .For e.g. when you boot kernel you know that a certain memory location a certain function is present is present
    . You can call that function directlt knowing what parameters you have to pass.

  • @ozancanacar8237
    @ozancanacar8237 Před 6 měsíci

    Amazing content! Just wanted to say that you can also use std::function as a generic function pointer now. Additionally, If you are required to use this on an object's member function you can wrap it with std::mem_fn.

  • @YadavJi-im6mw
    @YadavJi-im6mw Před 6 lety +2

    This is the best video for function pointer which covers almost everything about the topic function point thanks for uploading such videos.

    • @CppNuts
      @CppNuts  Před 6 lety

      +Yadav Ji waao thanks for such a nice comment, i try my best.

  • @bluehornet6752
    @bluehornet6752 Před 6 lety +2

    Nice video. The use of function pointers, although relatively simple to start, can quickly get pretty complicated even to the point of obfuscation. Your examples are pretty clear and straightforward. Nice job!

  • @warrior5741
    @warrior5741 Před 4 lety +1

    thank you so much for function pointer. i browsed so many sites but i found this channel is very helpful and clear my doubts.

  • @sasikumarreddyanipireddy
    @sasikumarreddyanipireddy Před 4 lety +2

    This is the best explanation about the function pointer sir..it's so helpful for my practice..am so thankful to you for sharing ur knowledg. Plz update more vedios in C-language

  • @MemoriesforLives
    @MemoriesforLives Před 6 lety +3

    I have just became fan of your series...keeping sharing your knowledge with us

    • @CppNuts
      @CppNuts  Před 6 lety

      +monika sharma, Thanks a lot for such a nice comment.

  • @snehashishpaul2740
    @snehashishpaul2740 Před 6 lety +2

    It would have taken a lot time for me to understand these concepts. But you have explained it so nicely. Many Many thanks to you Rupesh.

    • @CppNuts
      @CppNuts  Před 6 lety

      You are most welcome!!

  • @ohmnamo7056
    @ohmnamo7056 Před 4 lety +1

    thanks a lot man....you make us understand the exact concepts without any stories....thanks again

  • @user-wp5bk5cy6r
    @user-wp5bk5cy6r Před 9 měsíci

    i think the last parameter for qsort() function is a comparator function, which usually has return a type of bool.

  • @bsgamer5069
    @bsgamer5069 Před 3 lety

    Damn. Indian CZcamsr’s tutorial is the best

  • @PerchEagle
    @PerchEagle Před 5 lety +2

    all are excellent questions and the answers are also clear and simple.

    • @CppNuts
      @CppNuts  Před 5 lety +1

      Thanks for your comment dude!!

  • @karthickrajendran7057
    @karthickrajendran7057 Před 2 lety

    Real Master of Programming

  • @spicytuna08
    @spicytuna08 Před 6 lety +1

    got your point. i knew qsort use this. but this is not a dynamic binding. i haven't come across a situation where dynamic binding of function pointers is needed.

    • @CppNuts
      @CppNuts  Před 6 lety

      This is actually a dynamic binding, when you pass some pointer to some function in this case we are passing function pointer then you can pass any other function pointer at run time, depending on the situations.
      Example:
      if(some condition true)
      qsort(begin, end, fun1);
      else
      qsort(begin, end, fun2);

  • @ridcully
    @ridcully Před 2 lety

    Good conversational explanation style

  • @danf4321
    @danf4321 Před rokem

    Thank you! This video was very informative

  • @nickeax
    @nickeax Před 3 lety

    Thanks, it was very helpful.

  • @mithunkumar-ke2om
    @mithunkumar-ke2om Před 6 lety

    Really this video is very helpful ,thanks for uploading such type of nice video I have one request please upload one video on pointer to member function in c++ same as !

  • @sivaramakrishnachitithoti1428

    Thank you roopesh!!

  • @mytech6779
    @mytech6779 Před 2 lety

    Does the compiler no create pointers to all functions as normal operation? I understand this is the basic operation of a function call, the function is stored in global/static-data part of the binary and are then called to the working memory by pointer to that address. Making the function name into a pointer name seams very redundant. Because of this I do not understand why a function pointer would be used.

  • @ramgupta4612
    @ramgupta4612 Před 4 lety +1

    Thanks a lot sir...

  • @abhimankonda7151
    @abhimankonda7151 Před 4 lety

    could you please explain how compare function works with Array in qsort?

  • @glennmarkabalos6657
    @glennmarkabalos6657 Před 6 lety +1

    the qsort's last argument is a function.. how can a function have a function as an argument? can you make a tutorial about that?

    • @CppNuts
      @CppNuts  Před 6 lety +1

      Hi i have covered that topic in same video here: 6:33

  • @partha123dbr
    @partha123dbr Před 4 lety +1

    8:57 Please explain how to read the variable fun

    • @CppNuts
      @CppNuts  Před 4 lety

      Google it, how to read function pointer, because there is very good article. And i can't explain here.
      OR you can start here: stackoverflow.com/questions/2754586/reading-function-pointer-syntax

    • @liangwei4869
      @liangwei4869 Před 4 lety

      fun is a function(int,int) returning pointer to function(int,int) returning int

  • @rtzstvn
    @rtzstvn Před 5 lety +1

    great vid! Use this knowledge and applying at work.

  • @glennmarkabalos6657
    @glennmarkabalos6657 Před 6 lety +1

    i have a question.. why does the compare function accept 2 const void *p.. what is this? and what were passed?

    • @CppNuts
      @CppNuts  Před 6 lety

      +glenn mark abalos It is because void pointer is generic pointer, so for now we were passing integer but there could be situation where you will sort array of objects and in that case we will have to compare two objects on the basis of some parameter you will say that one object is small than the other one.
      So as you can see that we don't know what we will sort so that's reason we are sending everything in void pointer, because that is generic pointer and can accept anything. And we are using const because we don't want to modify the data in compare function.
      And if you're confused with how parameters are passed to compare function then it is the job of qsort function that's why we are passing our own function to qsort as parameter.

    • @glennmarkabalos6657
      @glennmarkabalos6657 Před 6 lety +1

      i see.. it's my first time seeing that concept.. thanks.. nice answer..

    • @CppNuts
      @CppNuts  Před 6 lety

      +glenn mark abalos welcome dude.

    • @glennmarkabalos6657
      @glennmarkabalos6657 Před 6 lety +1

      another thing.. can you make a tutorial on how a function can return a two-dimensional array..

    • @CppNuts
      @CppNuts  Před 6 lety

      glenn mark abalos, sure..

  • @__hannibaalbarca__
    @__hannibaalbarca__ Před rokem

    func(2)[0](3,6) will be exist

  • @ashishgupta7849
    @ashishgupta7849 Před 3 lety

    just like callback functions in JavaScript

  • @Palletooriabbai
    @Palletooriabbai Před 3 lety

    are you codebasics . your voice 98% matches with his voice

    • @CppNuts
      @CppNuts  Před 3 lety +1

      No i am not CodeBasics. 😊

  • @sasikumarreddyanipireddy
    @sasikumarreddyanipireddy Před 4 lety +1

    Hello sir ...I want c program tutorials sir ..can u help me

  • @surya1harsha
    @surya1harsha Před 5 lety

    Nice Videos brother😊 one suggestion , please change your IDE background to white colour & font to black colour.

  • @selvapriya4115
    @selvapriya4115 Před 4 lety

    null pointer ??????????

  • @agitated_johnson
    @agitated_johnson Před 4 lety

    okay?