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/... Наука
You're now my number one source for learning C/C++ on RUclips! Please keep it up!
Cheers, thank you for the kind words!
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.
Cheers, thank you for the kind words!
Very Happy I found you on youtube. You are a wonderful teacher. Thank you.
Thank you for the kind words!
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 ❤
Cheers, thank you for the kind words!
Excellent!
I love the video.
Thank you for the kind words!
as always brilliant explanation thank you Mike
You are welcome!
You are not the only programmer whose lessons I follow but you are the best at all 💯, go ahead.
Cheers!
Really enjoying the series Mike. Just curious, did you mean to use 'vector_h' or 'vector_t' as the typedef?
Yes I did, good catch! _t is the proper convention in C for user defined types :)
thank you for the tutorial
Cheers!
This course is the best way to learn C ,thanks for the great effort .Will you add more videos in the future??
Cheers! Yes, over time I'll keep adding 🙂
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.
I think you got it!
Hey Mike, thank you for providing this amazing courses. Do you plan to publish this C course, and Computer System course to Udyme?
Thanks
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.
Pls make a video on
"multiple line Macros" in C. Thanks for such nice explanation...very informative and point to point explanation.
Cheers! Will note that down under the wishlist!
Hello, great video. I didnt really understand whats the problem with the function having a return type. Why did you use the pointers instead?
Can you provide a timestamp?
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
@@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 :)
Oki, thank you very much for the quick response. Then I will go on watching the next vides :)
hi, its a good series. no offend, but i expect indian accent... nice suprise :D
😅