66 - ARRAYS OF STRUCTURES - C PROGRAMMING

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello friends welcome to our Channel so in the previous session we have seen how to define a structure and then how to declare the structure variables and how to initialize the structural variables and how to access the members software structure so in today's session let us have a new problem adding of Spectras here so in the previous example we have defined a structure for a student having a members of Heidi name and percentage then we have declared one student variable so which is which is having an access with all the tiny percentage and the name and if I want to access or if I want to declare some for example tell students that means if I want to really it tends to read details and print them so I require 10 variables 10 structure miracles so we want to avoid the 10 structure variables we will replace that with arrays that means as you know that array is a function of elements with same time so while creating or by declaring a structure variable then we will use the Allens in order to get more number of variables so for example let us have a problem that that is really some 10 employee details and employ details I want to read 10 employee names so each employee will be having name and every ID and Celie so I hope you read the test and prize details that makes 10 implies the main EAD and salary of 10 empires so for this how to declare L structure variables so first I have to define a structure with all these three numbers right so then I have to declare structural variables so here I want to tell my so I have to declare 10 structural variables so rather than declaring 10 variables I can declare a single variable that is called and Eric so here an array is a touch of elements on here a collection of structural variables an array is a collection of structure variables in this example so first we have to define a structure with the following members so first let us discuss the structure and the different the structure so Specht so I will call it as an my the tag name is my employee and with the members character name of 20 so as the name is a string so string must be implemented by using the character array so for reading this name we have to declare one character so I have the character and the character me next hi my ID in Eid Eid means employ Andy so these are month of available days we can write anything right so we have to follow the rules which we have seen with the beginning sessions right then salary so let us take a salary so I have declared the salary with a negative end so it can have a maximum salary of 30 2007 67 so if it exists automatically we will get the negative result so if you want to lose two more value this salary how to declare this salary as along it I will use a modifier in order to increase the size of that variable so as here I am using just an integer so it can hold up to 32,000 768 so I am closing the structure now I have to declare so let us declare the structure valuable in the main function inside the main so may 1st ridiculous the structure minimal so here I have to declare his employees 10 employ details so rather than declaring all the televised I will just replace it with them so for declaration we have to lose the tag name and plus struct employee so here I have to use an atom that means employee EMP of n so this implies here EMP is a name which forces and structural variables now the remaining every every concept is similar the Allah concepts have similar so first we have to initialize the members so in order to initialize the structural members we have to use the structure variable as well as dot operator so in order to initialize a runtime we have to use scanf function so by using the scanf function to write so employee details so here I am to read the name for enterprise I live for an device salary for an invoice so for this purpose I have to use the iterative treatments so for iterative statements I have to write for I is equal to 0 I less then 10 hi Christmas so from 0 to 9 pretty they're employed me is entered employee name scanf so in order to read that we have to like employee name that is percentage and how to in order to access the name that is a member of a structure we have to use a special variable dot member that means year B of I dot name next we have to read the employee ID for errors in it printf and the employee ID right on the scanner to read it but there are priorities percentage D as it is a integer common ampersand so we are using the scanf function as it is a string we need not write the message so here it is EMP of a dot yay and then we have to read the salary of 10 employees again bring their employee salary Riveter and y7 using scanner which is also an integer so percentage deal and percent ELP of I such a minimal dot the member that is seven so here it will read the name employee ID and salary for all the ten employees so here we have to close the funny now I am able to breathe the same on the disk restrain that first we need to see them to write so what are the details of an employee so for this also we have to use the interactive statements so we have to write the thumb loop from I is equal to 0 I less than 10 and I will press press now I don't read their first one my name so my name is person is yes ELP of I dot name next this excuse me creative Edward IV is percentage did employee of I dot so what's available and he ended IND they gave you how to print the salary of eloquent all the templates my salary is absent HD ELP of I dot Sam if I drop seven so close the that was the main book so this is the simple program to read the the details of ten employees and break the details of ten employees so for this in order to rather than using the ten structure variables we're just taking one added which is having the number of structure variables so like this we can use the Alice with the structures here also we can use the structures and I mean Alice as a member of a structure hope you understood this simple concept and is of structures so if you like my videos share my videos with your friends and subscribe to my channel and if you are having any doubts regarding the C language post your doubts in the comment session so that I will definitely try to clarify your doubts and thanks for listening thank you
Info
Channel: Sundeep Saradhi Kanthety
Views: 62,523
Rating: undefined out of 5
Keywords: sundeep, saradhi, kanthety, c language, c programming, cp, computer, computer programming, loops, c programming training, c training, c language training, structures, members of structures, dot operator, structure variable, arrays, arrays of structures, iterative statements, tag name, structure declaration, structure initialization
Id: OuOlrC1WYPo
Channel Id: undefined
Length: 12min 1sec (721 seconds)
Published: Fri Nov 03 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.