Your Second Day in C (Understand .h header and .c source files) - Crash Course in C Programming

Поделиться
HTML-код
  • Опубликовано: 12 июн 2024
  • ►C Programming playlist: • C Programming Series
    ►Find full courses on: courses.mshah.io/
    ►Join as member to get perks: / @mikeshah
    ►Lesson Description: In this series of lessons I provide you with a crash course in the C programming language. In this lesson I will show you the difference between a .h file, and a .c file. This will lead us into a small discussion and demonstration of how to structure a C project. We'll also be reviewing several of the topics from the first video in the playlist linked above.
    00:00 Introduction
    00:40 Discussion of header versus implementation files
    3:40 Creating a main.c file.
    4:00 The vector struct that we are creating.
    5:20 The header and implementation for our math library
    7:00 Sketching a vector 'Add' function.
    8:45 Including files is a copy and paste by the preprocessor
    10:20 Header Guards discussion and usage
    11:40 Implementing the functions in our header file in our .c file.
    12:40 Refactoring our 'Add' Function
    15:00 const parameters
    15:57 Using our Math Library
    17:00 Different ways to include files
    20:25 Successfully running our program.
    20:53 Review of what we have done.
    24:14 Review of compiling multiple files in C
    26:00 Conclusion and wrap up
    ►Please like and subscribe to help the channel!
    ►RUclips Channel: / mikeshah
    ►Join our free community: courses.mshah.io/communities/...
  • НаукаНаука

Комментарии • 33

  • @joaocesarlima7339
    @joaocesarlima7339 Год назад +8

    You're now my number one source for learning C/C++ on RUclips! Please keep it up!

    • @MikeShah
      @MikeShah  Год назад +2

      Cheers, thank you for the kind words!

  • @viktorkomarov8041
    @viktorkomarov8041 9 месяцев назад +2

    This is some sort of perfection: the quality of video, the theme you uncover, screen management, sound and explanation. You're criminally underrated teacher and video maker.

    • @MikeShah
      @MikeShah  9 месяцев назад

      Cheers, thank you for the kind words!

  • @dhanushs1802
    @dhanushs1802 Год назад +3

    Very Happy I found you on youtube. You are a wonderful teacher. Thank you.

    • @MikeShah
      @MikeShah  Год назад +1

      Thank you for the kind words!

  • @chriskiesel5360
    @chriskiesel5360 Год назад +1

    The world needs more people like Mike. That’s all I can say, you made it look so easy and smooth…. Thank you so much ❤

    • @MikeShah
      @MikeShah  Год назад

      Cheers, thank you for the kind words!

  • @blaisofotso3439
    @blaisofotso3439 2 года назад +3

    Excellent!
    I love the video.

    • @MikeShah
      @MikeShah  2 года назад +1

      Thank you for the kind words!

  • @sallaklamhayyen9876
    @sallaklamhayyen9876 2 года назад +5

    as always brilliant explanation thank you Mike

    • @MikeShah
      @MikeShah  2 года назад +1

      You are welcome!

  • @abdodaood3778
    @abdodaood3778 Год назад +1

    You are not the only programmer whose lessons I follow but you are the best at all 💯, go ahead.

  • @jimstorch4110
    @jimstorch4110 2 года назад +3

    Really enjoying the series Mike. Just curious, did you mean to use 'vector_h' or 'vector_t' as the typedef?

    • @MikeShah
      @MikeShah  2 года назад +1

      Yes I did, good catch! _t is the proper convention in C for user defined types :)

  • @deepblackoutlaw9640
    @deepblackoutlaw9640 3 месяца назад +1

    thank you for the tutorial

  • @aghiadalzein3069
    @aghiadalzein3069 5 месяцев назад +1

    This course is the best way to learn C ,thanks for the great effort .Will you add more videos in the future??

    • @MikeShah
      @MikeShah  5 месяцев назад

      Cheers! Yes, over time I'll keep adding 🙂

  • @slavapavlov9473
    @slavapavlov9473 2 года назад

    Hey Mike, thank you for the video!
    To recap.
    Let's say, we have our custom functions declared in custom.h
    We *#include** "custom.h"* both
    in custom.c (our functions are actually implemented here) and
    in main.c (our functions are used here).
    We don't compile .h files. Only .c files.
    For instance, *gcc main.c custom.c*
    The compiler glues them together and gives us one executable.
    Also, remember about so-called header guards in .h files.
    And be careful about data types we're passing into our functions.
    To be frank, I got the gist of it but to feel more comfortable with this topic I'll be looking for more examples in my C programming journey.

    • @MikeShah
      @MikeShah  2 года назад +1

      I think you got it!

  • @hounangogogo
    @hounangogogo 2 года назад +2

    Hey Mike, thank you for providing this amazing courses. Do you plan to publish this C course, and Computer System course to Udyme?
    Thanks

    • @MikeShah
      @MikeShah  2 года назад +1

      Eventually I'll rerecord the lessons in shorter videos and add exercises, and then post to thinkific or Udemy. There are a few systems videos in the pipeline a few weeks from now I am thinking qbout for posting here.

  • @akash-tj8ru
    @akash-tj8ru Год назад

    Pls make a video on
    "multiple line Macros" in C. Thanks for such nice explanation...very informative and point to point explanation.

    • @MikeShah
      @MikeShah  Год назад

      Cheers! Will note that down under the wishlist!

  • @tristan6535
    @tristan6535 11 месяцев назад +1

    Hello, great video. I didnt really understand whats the problem with the function having a return type. Why did you use the pointers instead?

    • @MikeShah
      @MikeShah  11 месяцев назад

      Can you provide a timestamp?

    • @tristan6535
      @tristan6535 11 месяцев назад +1

      You are starting to talk about this at 12:40 and you say it will cause a problem if „result“ is being deleted and I don’t really understand why it should be deleted so what the problem could be

    • @MikeShah
      @MikeShah  11 месяцев назад

      @@tristan6535 For this example it actually shouldn't cause a problem since we are using primitive types. I think this is me foreshadowing heap and stack allocated memory in future lessons :)

    • @tristan6535
      @tristan6535 11 месяцев назад +1

      Oki, thank you very much for the quick response. Then I will go on watching the next vides :)

  • @rudolfbouzek6944
    @rudolfbouzek6944 3 месяца назад +1

    hi, its a good series. no offend, but i expect indian accent... nice suprise :D