C Programming Tutorial 43, Include and Define Preprocessor Directives

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

It doesn't *complicate* it, it just adds more to the language!

sonickk
Автор

All of the definitions of stuff should go inside of the header files. That would mean things like enums, typedefs, structs, and function prototypes should be in there. All of the code for the functions should go in the .c files.

iTzAdamX
Автор

@TangoBravo 99% of c syntax works in c++. In fact many of the early c++ compilers simply translated c++ into c and than compiled that. 

srhalnon
Автор

Hi Adam,

Your videos are awesome. Very clear, concise, and to the point. So thanks for making them. I have a question though: what are some advantages of using macros over functions? I suppose you could save some time by not having to create a function declaration and what not but it seems like they both serve roughly the same purpose. What do you think?

Thanks again for making these very helpful and professional videos.

MrCavitysChessCorner
Автор

@lovepuremetal5 Probably not. However, once you learn C, C++ is really is to learn since the syntax is almost identical.

iTzAdamX
Автор

are u ever gonna do c++ tutorials?? ...cuz ur tutorials are really good

DarshanParajuli
Автор

LOL... Not hardly. There's this little concept called "Object Oriented Design" that complicates learning C++ just a tad.

tcbetka
Автор

It would seem that "myFile.h" is in a different location than "main.c", so according to what I heard you say, it should in fact not work, as the locations of "myFile.h" and "main.c" are different. Can you please explain how that works?

FelixNielsen
Автор

Hi Adam, I was having problems when I put all functions (including typedef struct and typedef enum) in myfile.c in an attempt to tidy up the main.c. I found that I still need to copy e.g. [typedef enum {} season; ] and [void printPhrase(season);] in both main.c and myfile.c in order for it to work. I workaround by putting all functions in the myfile.h and deleted myfile.c, and it works. I wonder if this will cause any problems later when the program gets larger.

suplattice
Автор

Would you get an error if your x value was a character?

weezywayne
Автор

the tutorials are good and all.. but i still don't understand the application of what you just explained.  Why would I want to do that... type of thing. 

I'm looking for a reason of use for these lessons are teaching and can't seem to think of any for some of them.  

Love the tutorials btw.

friendman
Автор

i can't get the file.h to work. i keep getting "Undefined reference to"printint" ". It works if i put #include"file.c" though. How can i get the header to work?(i'm using gcc in a terminal in linux)

adelin
Автор

05:40, why is it %i and not %d for integer? Can they be used interchangeably?

swallowedinthesea