C Programming Tutorial 44, Enumerations

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

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

It's good for representing items. For instance, let's say that you're making a game and the weapons in the game are as follows: knife, pistol, shotgun, sniper. Well it doesn't make sense really to store the weapon the player's using as a string, so you'd store it as an enum value.

iTzAdamX
Автор

Thank you so much...your demonstration is better than a book!

TheFlyguy
Автор

I just love the way you say "Yep, perfect" :D

crashowerride
Автор

Best explanation video i've ever seen of any programming tutorial. Very descriptive and clear, and tons of examples shown. Thank you so much.

dcsoccer
Автор

Thanks fo the video. My prof is terrible at explaining this kind of stuff.
Finally understood how enums work and are used in c thanks to you.

tobiasstrehler
Автор

Thanks for the video on enum. Video help me understand the topic.
Your a great teacher. Keep it up

mystiquegirl
Автор

you re extremly good at that ... thanks so much .

asrn
Автор

And this is really good then, say...in a switch statement. Since you have to switch on an integer (or an expression that evaluates to an integer), then you can switch on one of the enum values. LIke this:

void printPhrase(season s) {
switch(s) {
case summer:

etc...

tcbetka
Автор

nah I take my words back. C is still very widespread for scientific programming, embedded systems etc. Linux is written in C.
C++ is not a ripoff, its object oriented, has classes, templates etc. Both are great languages, I'd say THE best. So yea, C/C++ forever!

shebotnov
Автор

Could you tell me what software you're using as your C editor please?

Thanks, loving that built in compiler.

jammydodger
Автор

Thank you, you scared me! Actually there is still a lot of books being printed for C programming. I believe the Mars shuttle mission was controlled by 30000 pages of written in C++.

tickyul
Автор

One question Adam: Why "else if (s == spring)" ?

Are there any other seasons you've left out? Why not use "else" for the last control arm? ;)

tcbetka
Автор

It creates an array pointer in the memorry and all the "names" inside enum works like indexes 🤔🤔🤔

igorguimaraesdecastro
Автор

First of all, one of the best tutorial playlists on Youtube and thank you so much for it. Later on what if i want to check user's answer. I created this:
char Input;                                            

printf("Which season is in there ?\n");
scanf("%s", &Input);

printSeason(Input);

Rest of the code is an exact copy of yours. But it doesn't work. It runs and i give an input but than nothing happens. Anyone has any idea ? 

lespaul
Автор

Hey I am using c++ visual basic and i can get it to print one of the phrases by putting a number inside the brackets in the main...?? but it Works fine if i type one of the seasons

m.mohammad
Автор

it gives me a compilation erro when i call the method print: argument of type int is incompatible with parameter of type "myEnum". Please someone explain.

alexanderg
Автор

Adam i dont get what is enum good for?

thewhisperinyourears