 Come to the video lecture on Introduction to RA using C programming. At the end of this video lecture, students will be able to demonstrate the declaration and initialization of an RA and will be able to explain the concept of memory representation in an RA. The following topics will be discussed in this video lecture. RA, declaration of RA, memory representation of an RA, elements, initialization of RA. RA, need of an RA. Consider a scenario where you want to store one student's roll number, we declare one variable. In the same way, in order to store roll number of 100 students, we need to declare 100 variable names. Remembering 100 variable names and handling this variable names in the program is quite complex and tedious task. Therefore, we can use the concept of an RA which will make, which will allow to store and access 100 values using same variable name. In this way, RA is useful to make code simple. Definition of an RA. An RA is the collection of data elements of the same data type arranged in continuous memory location. Example may be a collection of integers, a collection of characters, collection of doubles. For example, if I want to store marks of five students, I can say it as fruit marks of five. So it will be stored at marks of zero, marks of one, marks of two, marks of three and marks of four. The different marks stored are 50, 60, 70, 80, 90. So how is the array declaration done and how is initialization done will be discussed in the next slide. In order to declare an RA in C, a programmer specifies the type of the elements, name of the RA and the number of elements required by an array as follows. That is type, array name, array size. This type of array is called a single dimensional array. The array size must be an integer constant greater than zero and type can be any valency data type. For example, to declare a five element array called amount of type int, use this statement int amount of five. Here amount is a variable array which is sufficient to hold up to five integer numbers. The size of this array will be 10, 20 bytes as four bytes are required to store one integer constant. Float salary of 10. Here salary is a variable array with sufficient to hold up to 10 floating point numbers. The size of this array will be 40 bytes as four bytes are required to store one floating point constant. Character name of 10. Here name is a variable array with sufficient to hold up to 10 characters. The size of this array will be 10 bytes as one byte is required to store one character constant. Now we will be discussing about the memory representation in an array. Suppose we have declared an array int amount of four. All the other elements will have garbage values assigned to it. All arrays have zero as the index of the first element which is called the base index. And the last index of an array will be total size of the array minus one. So it will be amount of zero, amount of one, amount of two and amount of three. And this will be there will be the different address location like 2686728 for amount of zero and 2686732 for amount of one, 2686736 for amount of two and 2686740 for amount of three. So these are the different address locations. So when I assign a value to index zero amount that is amount of zero equal to 11. The above statement assigns the zeroth element in the array with a value of 11. Pictorial representation of the array we discussed above is shown below. There is amount of zero will be assigned to 11, amount of one will be assigned a garbage value, amount of two garbage value that is the junk values and amount of three will also have a garbage value. Now this address locations are differing. The difference between their address location is four bytes. It means the size of the integer is four bytes. Now we'll be discussing about how we will initialize an array. Initialization means giving some initial value. The initialization of an array can be done either in a single statement or one statement as follows. Int amount of five equal to curly brackets 246810. The number of values between braces cannot be larger than the array size. If the size of an array is omitted, an array just begun off to hold the values initialized will be created. That is int amount square bracket 246810. Then fruit salary bracket two that is square bracket two is equal to 2,550,000. In this array, I have initialized the array with an array size equal to two. But I'm assigning three values which will create an error during the execution of the program. Character n empty square bracket with empty value equal to a b c d where a b c d are all character type of constants. It's a character. It's also called a string. Then int a c c id four is equal to zero one zero two one zero four one zero six. In this array, I have initialized the array with array size equal to four. But I'm assigning three values to array elements. One of the array elements will have a garbage value or junk value. The garbage value is zero for integer data type zero point zero zero for floating point data type and null for character data type. Now pause this video for a few seconds and try to write answer to the question. Which of the following is correct? Array declaration for storing bank balance of five persons. The first person first option is float balance. Curly brackets five float balance square bracket five for balance round brackets five or it is all of the above. So when we had declared the array declaration, it meant it should mention the data type. That is first three all all are the same. Okay. Next bank balance. It means balance is the data type or the balance is the variable name. So then five persons. It's correct. All three are there. Okay. But the main thing while declaring an array, it should have square bracket of five. So float balance square bracket five. It means the option or the answer for your question is option B. Now we will be writing a simple program to find some and average of marks scored by a student in six different subjects. Each subject has a having maximum marks of hundred. So this whatever program will be done using your code blocks software. So we'll be declaring a variable for marks. Okay. That is int marks of six. It means six subjects. So six int marks of six. So the array sizes six. Then I'll use I variable for that is loop counter. I want to marks of zero marks of one, two, three, four, five. Then I'll say float average. Now to find the sum value sum equal to zero. The starting sum is zero. Then I'll use your for loop for I equal to zero. I is less than six. I plus plus. Bracket. Enter the marks to go to the next line. Then scan it. Percentage. Marks of. So this whatever the thing I have written in the loop, it means it should ask the user to enter the marks scored in different subjects, different subjects. So it should be repeated six times. Then I say some is equal to some plus marks of I ending with a semicolon. I'll come back now. Final what is that I want the average to be printed average is equal to some divided by 6.0. Now what should we print average? I have to print also the sum by print of percentage D comma some ending with a semicolon. Then I'll say go for bill. It says zero errors, zero warnings. Then I'll go for compile. Total is percentage D and the average marks is percentage F. I'll compile it. Go for compiling. Build. Compile. Run. 60. 70. 80. 90. 90. 80. 90. So the total marks obtained is 480. And average marks is 80. These are the following references. Thank you.