70 - TYPEDEF with Example - C Programming

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hi friends welcome back to our Channel so long back we have stopped doing the videos saluting this lockdown I came to my home town and not able to make the videos so just a small video I just want to share with you so regarding this C programming it's a small concept that is type def keyword so we have seen several keywords that are available in C language so in that keywords this this is a one of the important thing the type def and small working so that is so this type def keyword so completely in a lowercase so type def so this keyword is used to create an alias name for the datatypes Ilias name for data types so we we have seen the data types like integers float character double right so structures unions and all these things so we have also seen the rule that we have to declare a variable before going to be used in the program right so for giving an alternate name for those data types we can use this type def so for example if you want to declare a variable using integer datatype so int a comma B comma C so we'll declare it this way so we'll use this in T word so if you use this type def c type def in integer so if you use this line this implies wherever we are using this Inc we can replace this keyword by using this alias name so in later we can declare the variables by using integer a comma B comma C and so for giving an alternate name for the data types we'll use this type def keyword I def keyword right so we can also use this type def for the structures unions and all the data types right so we'll see the practical session by executing a small program by giving an alternate name for the data types like integers float character as well as the structures right so we'll move on to the system hi friends so now we will see the practical implementation of 4 type def keyword in C language as I said that this type type keyword is used to give an alternate name for the data types so we'll see that how we can implement this one but we will include the header files then we can write the main function now we will declare three variables so normally if we want to declare any integer variable we'll use a keyword int sum a float float some B care some C right so here we are giving an alternate name for these data types so after they after the after this type diffuse keyword so we can create an alias name for the data types so for example I will use this type def keyword type def in space I will give it as an integer right similarly type def float and I will give as a fractional fraction okay same similarly type def character as character right see here also I am giving so here and using this type def keywords so that the int is it will be having this int will be having an alias name as integer similarly float will be having an alias name as a fraction similarly scare data type will be having the alias name of character so here we can declare the variable using integer because here now the data type is integer so we have we have defined the intimate as an integer so int a and C is equal to 10 similarly fraction to declare the float variables B is equal to some 3.14 right similarly character for character data types right C is equal to sorry C is equal to quotations a clear screen for clearing all the previous results then we can print all these things the percentage again or some a is equal to percentage D is a format specifier so a similarly printf /n b is equal to percentage EF b similarly will print the third character slash and c is equal to percentage see see right now will execute this one so errors are 0 so see what we have done is we are using this type definition the type depth keyword to create an alias name the alternate name for the data type so here we are giving integer as an alternate name for int so whenever we are going to use this int data type we can directly use this integer alias name okay c will run this so we'll get the results so for the result all temp I'll say a is equal to 10 B is equal to 3 point 1 4 C is equal to Li here we have not initialized them ok we have not initialized them using the primitive data types like int float character but here we are using their alias names so we are giving an alias name for integer and then we are giving and similarly we can also create an alias name for structures by using this type def c type def struct student and write down here into our number okay float percentage here we can give an structure variable st and here we can use this st as a structure variable so here C in the absence of this type def in the absence of this type term yes t is a structure variable right st is a structure variable inside the main function by using this is a student the name structure structure main student we can create more than one variable so here I am using this type def before this struct student so this will be the alias name for the structure st will be the last name for the structure so here we can initialize st dot our number is equal to some 123 similarly st dot percentage is equal to some 89 right so we can print the same here so we know that the structure variable can be a solid sorry so how to create one structure variable sts-1 right sts-1 so here s1 dot percentage now we can print the same here also print f /n our number is equal to percentage D comma s 1 dot R number all the struct in the members of the structure must be access to using the structure variable here s1 is a structure variable and est is an alias name okay wrong game Delphine's sta alias name because we are using type def at the beginning of stunt percentage f s 1 dot percent greater we will compare it and we will run it so you can get the result by using alter 9 so a is equal to 10 B is equal to 3 point 1 4 C is equal to a our number is equal to 123 8 percent 8 is equal to 89 right so here once again M same type that is giving an earliest name for the data Tex so here for int we are giving integer for float we are getting fraction for care we are getting of character and here for type def we can also create an alias name for the structure so with the absence of this type def st will be the variable of a student but here we are using the type def so st will be the alias name for the student so inside the main function we can create a more number of structure variables by using the alias name yes t instead of using the student right so hope you understood this one it is a very simple concept type def type there is a keyword which is used to give an LS name for the data type right so hope you understood this one so let us pop here so if you are having any doubts regarding this type def so feel free to post your thoughts in the comment section so that definitely I will try to clarify all your terms and it should be real let us put my session like my session share my session with your friends and don't forget to subscribe to our Channel so thanks for watching thank you very much
Info
Channel: Sundeep Saradhi Kanthety
Views: 5,410
Rating: 4.9767442 out of 5
Keywords: KEYWORDS, VARIABLES, C LANGUAGE, COMPUTER, COMPUTER PROGRAMMING, BACKSLASH CONSTANTS, CONSTANTS, SUNDEEP, SARADHI, KANTHETY, SUNDEEP SARADHI, NEW LINE CONSTANT, INPUT STATEMENTS, OUTPUT STATEMENTS, PRINTF, SCANF, c programming, c language, compiler, c compiler, binary, object code, c code, coding, exe code, .c, .obj, .exe, c files, sundeep, saradhi, kanthety, cp, computer basics, programming, software, c programming language, c language for beginners, typedef, typedef example, typedef program
Id: t9RoDlnQ8mI
Channel Id: undefined
Length: 10min 39sec (639 seconds)
Published: Thu Apr 09 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.