#27: Enumerations(enums) in C | C Programming for Beginners

preview_player
Показать описание
Enumerations(enums) in C | C Programming for Beginners

In this video, we will learn about enums in C Programming. We will learn to create variables of enum types and use them in the programs. We will also learn about enum constants that are internally represented as fixed integer values known as integral constants. We will try out many examples so watch this video to have a clear understanding of enums.

~
Resources:

Timestamps:
00:16 - Enumeration in C
01:36 - Integral Constant
03:44 - Change value of Integral Constants
07:08 - Programming Task
07:47 - Quiz

~

Revise your learning using our C App

Find Programiz elsewhere:

#programiz #cprogramming #enumerations #enum #integralconstant #learnprogramming
Рекомендации по теме
Комментарии
Автор

Finding C programming hard? We’ve got you!
🚀Get 60% off on Programiz PRO Lifetime Plan this Black Friday—pay once for skills that last forever. Don’t miss out, it’s a limited-time offer!

programizstudios
Автор

Option C : currentDay



#include <stdio.h>

enum {
sunday,
monday,
tuesday,
wednesday,
thursday,
friday,
saturday
}weekend1, weekend2;

int main() {

weekend1 = saturday;
weekend2 = sunday;

printf("%d\n", weekend1);
printf("%d", weekend2);

return 0;
}

onic
Автор

#include<stdio.h>
enum c
{
sunday,
monday, tuesday, wendnesday, thursday, friday, saturday
};
int main()
{
enum c weekend1 =saturday;
enum c weekend2 =sunday;


printf("%d", weekend1);
printf("\n%d", weekend2);

}

Ffttrruhvfftbvf
Автор

#include <stdio.h>
enum weekDays{
satarday,
sunday,
monday,
tusday,
wednesday,
thursday,
friday
};
int main() {
// Write C code here
enum weekDays weekend1 = sunday;
enum weekDays weekend2 = friday;
printf("%d\n", weekend1);
printf("%d", weekend2);

return 0;
}

bsh_bsh
Автор

#include <stdio.h>

enum weekdays{sunday, monday, tuesday, wednesday, thursday, friday,
saturday
};

int main(){
enum weekdays weekend1= saturday;
enum weekdays weekend2= sunday;

printf("%d\n", weekend1);
printf("%d", weekend2);

return 0;
}

charanjitkaur
Автор

Thank you Programiz, for these amazing tutorial video series!

ntnmfbu
Автор

Task:

#include <stdio.h>

enum Days {
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday
};
int main() {
enum Days weekend1;
weekend1 = Saturday;
printf("Value of Saturday: %d\n", weekend1);

enum Days weekend2;
weekend2 = Sunday;
printf("Value of Sunday: %d\n", weekend2);

return 0
}

Quiz: C is the correct option

Eileen-in-the-coding-maschine
Автор

Q. What is the name of the variable in the following enum?

enum Weekends {

Friday,
Saturday,
Sunday
} currentDay;


a. enum
b. Weekends
c. currentDay
d. Friday

programizstudios
Автор

Many Thanks
The content is informative and very good.

lamaspacos
Автор

currentDay is the name of the variable inside that enum type.

KoreanLolMontage
Автор

#include<stdio.h>
enum Weekdays{
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday
};

typedef enum Weekdays Weekend;

int main(){

Weekend Weekend1 = Saturday;
Weekend Weekend2 = Sunday;

printf("%d\n", Weekend1);
printf("%d", Weekend2);

return 0;
}

YUPENGMA-hy
Автор

#include <stdio.h>
enum size {
sunday, monday, tuesday, wednesday, thursday, friday, saturday
};
int main () {

enum size weekone;
enum size weektwo;
weekone = sunday;
weektwo = saturday;
printf("%d\n", weekone);
printf("%d\n", weektwo);

return 0;

}

barkhadibraahim
Автор

#include <stdio.h>

enum day {
Sunday,
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday
};


int main() {

enum day Weekend1 = Sunday;
enum day Weekend2 = Saturday;

printf("%d\n", Weekend1);
printf("%d", Weekend2);

return 0;
}

JeongWoonKim-ij
Автор

Where would enums be practical to use in a program compared to regular variable assignments? I understand the concept but im genuinely curious what would be some situations where enums would be better than usual methods?

Clasped
Автор

Why can't we assign float values to enums

golisrija
Автор

#include <stdio.h>
enum week{
sunday, monday, tuesday, wednsday, thursday, friday, saturday
}week;
int main() {
int week[7] = {sunday, saturday};
for(int i= 0;i<2;++i)
printf("\n%d", week[i]);
return 0;
}

matthewgoldman
Автор

#include <stdio.h>

enum week{
Sunday,
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday
} weekend1, weekend2;

int main(){


weekend1 = Sunday;
weekend2 = Saturday;

printf("Weekend1 is %d\nweekend2 is %d", weekend1, weekend2);

return 0;
}

bryanbalantes
Автор

#include <stdio.h>

enum Days {
Sunday=0,
Monday=1,
Tuesday=2,
Wendzeday=3,
Thursday=4,
Friday=5,
Saturday=6
}weekend1, weekend2;



int main()
{
weekend1=Sunday, weekend2=Saturday;

printf("%d\n", weekend1);
printf("%d\n", weekend2);

return 0;
}

keshavdixit
Автор

You are talking a lot about suicides here

fajfuss
Автор

#include <stdio.h>

typedef enum Day{
monday, tuesday, wednesday, thursday, friday, saturday, sunday
}day;

int main() {
day weekend1 = saturday;
day weekend2 = sunday;

printf("weekend 1: %d\n", weekend1);
printf("weekend 2: %d\n", weekend2);


return 0;
}

MutyalaDinoAbhishek