you will see what is the need of ferry what does any types of ferry how areas can be declared how arrays can be initialized and how data is to be represented in memory or you can see the memory representation of an array fine see I guess you are aware with the fundamental data type status int float care double etc and if I write like this int a is equal to 5 it means you have declared one variable variable name is a type of the data type of this variable is int and the value stored in this variable is 5 finally this is one variable variable declaration you can see now how this venue is to be stored in memory let us check so let us take this is our main memory you can draw it vertically you also fine so see these are bytes so you can say memory is a long tape of bytes you can say by it means 8 bits this is one byte this is one byte this is 1 byte like this so this can be extended to this side and this side also that is why I am taking open-ended so now how this variable can be stored here when the compiler compile this line then what happens the word memory manager will do memory manager will allocate some space for this variable to store this value 5 here how much space would be allocated see the data type int how many bytes it will take 4 bytes in typical compilers to store an integer data type it will take 4 bytes in traditional compilers we consider it two bytes so you can say 2 or 4 its approve generally we take 4 bytes that is why I am taking for storing 1 integer it will take 4 bytes fine so we have only 1 integer that is why how much memory would be allocated 4 bytes would be allocated 4 bytes fine it means how many bits get into 4 that is 32 bits because one bite one bite is equal to 8 bits fine now how the state has to be store first of all this decimal number 5 has to be converted into binary it's binary number sorry that is in 32 bits how in 32 bits this number can be represented like this 29 zeros would be there and then we'll write 1 0 1 now this binary this binary number is to be stored in memory now how this data is to be stored this 4 bytes is to be allocated 1 2 3 4 let us suppose these 4 bytes are to be allocated to store this 5 like this these 4 bytes so these 4 bytes are this is a closer look here we are going to store these visits like this and 1 0 1 and the end 8 bits here eight bits 8 bits 8 bits that is 32 bits this is how the number is going to be stored in memory fine and suppose at address you can say C address is always in hexadecimal form but here for simplicity purpose I am taking let us suppose the addresses address of this byte is hundred let us suppose so address of this byte would be 1 0 1 1 0 2 & 1 0 3 so it's 100 1 0 1 1 0 2 1 0 3 these 4 bytes to be used to store the center see this address would be in hexadecimal form always it's not like hundred or thousand or something like this hexadecimal means always hexadecimal would be represented by prefix with the 0x then you can say 677 see and 0 something like this in this form the address would be there but here I am taking just hundred for simplicity purposes so now I'll discuss what is need of Faerie see in this variable we can store only one value at a time if I want to store 6 then what would happen I will write here 6 and 5 is overwritten 5 is no more now fine if I want to store 7 then I will write 7 and now 5 and 6 are no more and here you will insert 7 or you can say overwritten those 5 & 6 so at one time you can store only one value if I want to store more one will you suppose in my class I have sixty students and I want to store all umbers of all the 60 students now what would happen you have to take in this case if you follow this approach in that case we'll have to take sixty variables because one variable can only store on one value at a time see because we have to process large amount of return that is why the concept of array came now you will modify this declaration such that under one variable name we can store roll numbers of all 60 students that is what array now how you can do this see same data type would be there here we have name but rather than storing one value now I want to store 16 values now obviously you how to tell the compiler that I want to store 60 values then you have to give the size of your array so here like this we are going to give the size fine so this is what you can say that declaration of a general syntax would be what data type then air a name any name is a then in brackets size of the air and here you will write what constant well okay see this is invalid declaration if you write int a this this is invalid declaration you cannot leave it blank this is also invalid declaration if you write into a and here you write sizes n sorry int N and here you here you write n this is also invalid declaration here you have to write what constant you can write here a variable but in that case for that case you have to declare macros before main function and below that header files you will declare one macro you can say hash define variable name n size is hundred in that case after that in main function you can write int a and in breakers you can write that variable name fine that is different logic but simply you cannot declare something like this you have to declare this datatype then arrayname then sighs sighs should be constant now see this declaration of arrays language-specific I am here considering the syntax in C language in Python maybe it's different in Pascal in you can say that foreign language the declaration syntax would be a little bit different so it is language specific fine now this is what the array declaration now see this is declaration of 1d array types of era types of array three types of arrays are there one day array one dimensional two dimensional and multi-dimensional array so in this video I am going to talk about 1b array so this is declaration of 1d array so in this we are having one row with 60 columns 60 values in columns fine now see how the arrays can be initialized and after that we will discuss how the air is can be represented in memory so see how you can define an array what is definition of error you can say that array is a collection of more than one data item so more than one elements but condition is what the data type of those elements should be same or you can say collection of for the more than one data items of same data tank see here five we can store five elements in the array but all the five elements should be of integer type let us take this example see this is a valid array because here the size of air is 1 2 3 4 5 5 elements are there but all the five elements are of same data-type that is integer here all the data items are of same data-type that is character you can also declare a character array like this data type should be character suppose name of arrays a or b you can take and size is suppose and that is also fine you can take float area also like this float array name is suppose B and I am taking size is fine so that is also fine but see this is fine this is fine because all in this in this array all the elements are character type same like but this is not valid this is not valid because in this array one-two-three-four-five size is five but here we have integer value also and character value also so different datatypes items are there that is not possible in area all the data items should be of same data-type now how the data how the elements of the arrays are stored in this memory all the elements are stored in consecutive locations or you can say continuous locations one after another how the data is to be stored in the memory I'll discuss in this video only but that is a very important point fine all the elements have stored in consecutive locations and index will be started from zero although somewhere we can start the index from one that is also fine but generally we take the index of array should be started from zero now how to access those elements of the array we will also discuss that thing right see now how the arrays to be initialized and it can be initialized by two types one is at compile time and one is at runtime compile time means static initialization would be there at the time of declaration only at the time of declaration own only you will specify what what elements you want in the array and at runtime means while executing the program at the runtime you can ask from the user what are the elements of the array fine now one more important point about arrays that that it is a fixed size array now we have declared sizeof array that is 5 now at runtime you cannot change the size of theory it's not like you can store six elements fine you can store only five element maximum you can store two elements that is fine but you cannot exceed from this limit this is fixed now this is maybe you can say a drawback of a that you cannot change the size of the array during runtime although one concept is there that is of full dynamic array but we will discuss those things in later what is dynamic array what is the language something like this in this video I am discussing only the fundamental so very so now we will see how era can be initialized at compile time first of all see and the time of declaration only you will specify the elements of theory suppose five elements I want so I can specify here these five elements right so that is fixed these five elements will be stored in the array this is compile time initialization here the size is five so you cannot write here six elements if you write six seven or more than five elements then it will give a compile time ever you cannot exceed from this limit although you can specify less than five elements if I specify here only six and two that is also fine remaining four remaining four position it will store what 0 it will initialize doing 0 but more than 5 you cannot write here so this is a compile time initialization now how these did this these elements has to be stored in this memory latest check see now the size is to be located is 5 into 4 that is 20 bytes memory manager will allocate 20 bytes but in consecutive bytes consecutive bytes should be located let us suppose it here allocate from this address and let us suppose address I am taking hundred so till 100 - 1 0 9 here the data is the memory memory is to be located for these elements now how the data is to be stored first of all the 6 6 is to be converted into binary form and then the data is to be stored here 6 is to be stored here 6 in these 4 bytes next to be store so this is how the step is to be store see first of all this is to be converted into binary phone fine but I am NOT taking here binary form I am just simply writing 6 in these 4 bytes in these 4 bytes - then 4 then 3 & 0 see this 6 2 4 3 & 0 these are in consecutive locations continuous locations so for simplicity purpose I am going to represent this data like this fine this bloke is having these 4 bits this is also having sorry 4 bytes this is also having 4 bytes that is 32 bits but for simplicity purposes I am writing here like this so this is her array name is a and address of this's hundred hundred so now address of this two thus a dress of two would be what see this 2 would be 1 0 4 this would be 1 0 8 this would be 1 1 2 and this would be 1 1 6 and why so because this this element is going to take 4 bytes ones 101 0 1 1 0 2 & 1 0 3 that is why it is 1 0 4 how this address is to be calculated what is the formula since the formula is before going to formula lentes check the this this index would be 0 1 2 3 4 we are going to start the index of this array with 0 for simplicity purpose somewhere it is also started with the one that is fine but here I am going to start with 0 so now how the data is to be accessed how you can calculate this address so this is how you can write at a of a or 0 at index 0 we have 6 a of 1 we have 2 a of 2 we have for something like this fine how to access how to access the data how to calculate the address see we know the base address of there a base address means from where the arrays to be started that is to be started from 100 so base a addresses 100 so how does this address is to be calculated suppose I am a Louise I would be starting from 0 till 4 means 0 to n minus 1 or you can say size of array n is equal to size of any right so if you want to access I is equal to 2 this data when I is equal to 2 means I is equal to 2 that is third when you how to access this value so the formula would be base address Plus this I value into size of data type you have taken the data type of array is here in so size would be 4 bytes now how to calculate address for this location I is equal to 2c base addresses hundred so the DS address would be in hexadecimal form just to make you understand I am taking here in tisiphone hundred plus I values to you want to calculate address for this two into size of data type data type isn't size would be four bytes so now here you will take hundred plus eight that has one zero it the location would be one zero eight where this well lose there that it I used to be there so that is why a of 2a of 2a of two is what for that is this is how you can after finding the address you can access the data fine so say see the array follows the random X's you can access any data with a constant time if you know the base address because if you know the base address you just simply need to do only one plus and one into one you can say addition and one multiplication and you can X is the data so that I am taken for this accessing is order of 1 that is constraint time and array follows what random X's method and let us suppose if you take character Airy here me how cat canary name is B and I am taking here sizes 10 and Here I am initializing this character array also and I am taking some values fine so now how these value is to be stored see I have taken sizes 10 so in memory how many bytes is to be allocated so for this size of character is character will take one bite one in two sizes 10 here we have 10 characters so 10 bytes would be allocated fine somewhere 10 bytes should be consecutive let us suppose this air is also there and after maybe not 1 1 9 but from here from here from 120 to 120 to 10 bytes till 132 has been allocated to this character array B so how the data is to be stored here here this paste is to be allocated now this this data is to be stored here but here we have null because we are specified only one two three four five characters but the size has been allocated to four ten characters so this is now you can say that wastage of space so now see the drawback you can say the one another topic of the series what you have to specify the size at compile time but in advance we don't know how much space we need it may be sometimes you have declared that I want an area of size hundred so now that hundred the space of that hundred element so you can say four hundred bytes has been allocated to you for this any name a but actually you are using only you are storing only 10 integers so you are wasting that space now so that is a drawback often that array that static declaration of Eric and sometimes you want to store more data then you have declared here now suppose you have declared the size of arrays hundred four hundred integers but now actually when runtime you want to store 200 integers but that is impossible because you have already declared the size now if you ask to the memory manager that I want to store 200 integers so I want to extend my area so now what memory manager will do memory manager will allocate you our space or fresh new space of for for 200 integer so you can say 800 bytes in consecutive locations and what my mail manager will do memory manager will copy the data because previously he has allocated space for hundred integers to you so those hundred integers would be copied from there to the new location fine so that would be very tedious work to do so this is how you can initialize there at compile time only now I run time how to initialize so at run time you can initialize the array using loops maybe for loop while you do Loup and some predefined function standard functions that is scanner I'm going to write down that code here see let us suppose I have I have declared an array of size five fine now at runtime I want to ask from the user which data he wants in this area so now what I'll do C printf function is for what for printing something on the spring show so I am writing here enter the elements of array so this line is to be printed on your screen now for taking the input from the user you will write what scanner but first the most important point about this is you have to use some loops because you are going to take continuously five integers from the user so we'll suppose I am taking for loop here and I I would be started index would be started from zero I less than size minus 1 that is 4 and I plus plus so within this for loop you can write percentage is DN and rename a so this is how during runtime you can take that value from that a I am going to discuss it how the data is to be taken from the user how the data is to be stored in the array in next video so these are some points that we have discussed in this video see arrays are fixed size fixed size means once you have declared the size at compile time you cannot change it at runtime fixed size sequenced collection of data items of same data-type data items should be of same data-type that is also a drawback of the air fine X is a particular element in the array what you will have to write just write array name and in the brackets you will write the index value suppose you want to access the first element then you will write what array and in bracket you will write a 0 because we are going to start the index from 0 data items are stored in continuous locations and random access is there you can access any element and that will take a constant time order of and how we are going to access that I have discussed with the help of formula I have so various three 1d 2d and multi-dimensional array we have discussed how 1d array say this topic we have discussed declaration insulation accessing of this 1d array in next video we are going to discuss how the data is to be inserted how the arrays to be traversed different types of operations on 1d array first of all with their time taken and after that we will discuss what is 2d array as well as how the data is to be accessed from 2d array fine so I'll see you in the next video till the map IIT