Legal Ways To Call Void Functions | C Programming Tutorial

Поділитися
Вставка
  • Опубліковано 8 вер 2024
  • Learn about the different legal ways to call void functions in C. This video is mostly just for fun as the unusual but still legal ways that we can call void functions are either not useful or generally considered bad practice. Source code: github.com/por.... Check out www.portfolioc... to build a portfolio that will impress employers!

КОМЕНТАРІ • 31

  • @Rai_Te
    @Rai_Te Місяць тому +3

    For the sake of completeness ...
    you can have a variable of type 'pointer to function returning void',
    assign your void function to this pointer (which basically copies the entry address of the function into the pointer)
    and finally call the function via the pointer.

    • @PortfolioCourses
      @PortfolioCourses  Місяць тому

      That’s true! :-) Anyone interested in learning about this may find this video on function pointers interesting: ua-cam.com/video/f_uWOWViYc0/v-deo.html

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

    I think if you are writing a wrapper around a void function it might be better practice to do "return func();" because if the definition of func() changes to output a type then you want a compiler error

  • @harald4game
    @harald4game Місяць тому

    void func() {}
    #pragma startup func
    #pragma exit func
    gcc:
    void __attribute__((constructor)) func();
    void __attribute__((destructor)) func();
    Not sure if it counts because it depends on the compiler.

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

    Hello sir, could you make a playlist on implementing data structures in c exactly like we use stl in c++
    like for example we have to declare the size of array beforehand for stack implementation using arrays in c. But like the stl works we don't need to provide the size before using the stack. I want this for all data structures. Thank you and awesome content

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

    Thank you so much for making these videos.

  • @achv4668
    @achv4668 Місяць тому +2

    May i ask , what editor are you using ?

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

    Didn't know about the bracket operation

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

    Thank you

  • @englishpod1206
    @englishpod1206 Місяць тому

    Appreciate the explanation. Can you make a video about global variables. Thank you again❤❤❤

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

      Yes, this video should cover them: ua-cam.com/video/qXVIMX2GlK8/v-deo.html

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

      And you might like this one too on sharing a global variable "across files": ua-cam.com/video/Wqm1tSzmqkY/v-deo.html

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

    , operator has defined order of execution now?

    • @NIKITA-jy5pv
      @NIKITA-jy5pv Місяць тому

      Yep, always has been. It has undefined order of execution when calling functions, like passing parameters to it.

    • @PortfolioCourses
      @PortfolioCourses  Місяць тому +4

      Yes that's correct, when calling functions it's technically being used as a "separator" and not as an "operator". That may actually be a good video topic, to make that clear...

  • @Awwe12675
    @Awwe12675 Місяць тому

    Can you please explain thread all functions in library threads

  • @silloo2072
    @silloo2072 Місяць тому

    Thanks i didn't know that was a thing thank

  • @rezah336
    @rezah336 Місяць тому

    that was pretty useless, but fun

  • @englishpod1206
    @englishpod1206 Місяць тому

    Road to 200k ⏩

    • @PortfolioCourses
      @PortfolioCourses  Місяць тому

      :-)

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

      The only thing holding him from 10,000,000 subscribers is light theme

    • @briman113
      @briman113 Місяць тому

      Looks like 200K has been achieved 👍

  • @kingeric1992
    @kingeric1992 Місяць тому

    return function1(), 0;

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

    Wow someone is using vanilla C in 2024 😮