Global variables in a multi-file project in C

preview_player
Показать описание
Source code can be found here:

===== Support us through our store =====

===== Check out our website =====

===== Check out our Discord server =====
Рекомендации по теме
Комментарии
Автор

It is funny how I feel like I have taken seemingly simple things like this for granted. Even after using C off and on for many years, I still learn some new subtle things about the language, especially from watching your videos. Thank you for this.

Yankeeed
Автор

Awesome job describing header file usage and importance.
Additionally, good to see you're back and making more content for 2022 - good stuff.

NOPerative
Автор

Very clearly explained! Many, many thanks for that!

leythecg
Автор

thank you man for explaining global and external in simple way with actual demo.

roopibhai
Автор

Your simple way of explanation is unique. Your videos make me love coding. Thanks, man <3.

hossamnasser
Автор

Thanks for this explanation. Simple and straightforward. Exactly what I needed!

boryswwa
Автор

It's just simple and important things that I've learned from this video

sflrvnz
Автор

Hello from Georgia <3, I am very helpful with your videos, you are doing a very good job for free,
This is something we need for beginners.

romakekua
Автор

Thank you so much for this video. I was looking for more clarity on this topic.

reshmaimmaculater.
Автор

Thank you for this video..This video is a necessity for anyone who works in a real team environment and do real coding not interview coding

nishant
Автор

Life saver. I was cracking my brains on that

neetorstar
Автор

Hi... Thanks for this video. I've one question: if you are including the "global.h" file in multiple .c files, is there a need to protect the extern declaration? I mean, do you need to use #ifndef in this "global.h" file?

fuscatube
Автор

What if don't create the file "global.c" and declare global variables directly in the header file "global.h"?

video
Автор

You were back and I missed it. I have failed you...

KFlorent
Автор

Rather than modifying the x, I'm trying to retrieve its value in the main2.c function. But apparently this doesn't do it, when I print x in main2.c is set back to 0. Is there any way to do this? I thought global variables would do the trick. Edit: I must use two distinct executable files for this, that's kind of required for my project.

alvarogaliana
Автор

Hey I have a doubt, If I want to access a global variable and change the value of that variable in another file.how can I?

saikishorekemburu
Автор

Hey, I have one doubt. If I want to share a global variable across two C files which are in different directories, then how to do that?

raghavimadhwa
Автор

Hey,
good explanation but I have one doubt ? when you rrun both files in same terminal in VS code which file's integrated terminal was used ? I am confused actually .

tekshanmadhawa
Автор

Why is c so simple and python I just struggle to understand

markm