 Hello. Welcome to the session area of strings. At the end of this session the student will be able to implement C programs using area of string. What is the area of string? First we will see a single string is nothing but an area of characters which is terminated by slash 0 that is the null character so that it will indicate that this is the end of this particular string. An area of string is 2D area of character. Here we will see the example and then we will explain how it is to be declared. So here an area of string is 2D area of character like float or integer we can declare the character array that or it is also called as area of string. So here one example is the character CH array 3 by 10 so here total three strings we can store and its length may be maximum 10. If we are storing or declaring array in single code we need to remember that it is important to end each 1D array by null character and if we are declaring with double code then there is no need to end each string with the null character this will be automatically added by the compiler. So here we will see how to declare area of strings. So here we are declaring character variable name that is the any string name then rows and columns rows is indicating total number of maximum string and then column that will be declared how many characters in that particular string that is the maximum character should be in that particular string. So here one example it is shown that memory location 65454 it is the pointer is started so total 6 string we are storing here so here rows may be string 6 and here the length will be mentioned in the column. So if we are going for 6 into 10 then total 60 byte memory location has to be allocated for this two dimensional array that is the array of string. Now this is the example how to read and print the string here we are created that array of string so here character name that is 6 total string may be accommodated in this and maximum characters may be 15. So here integer length i then we are having the pointer and here we are going to read or first scan string one by one. So first printf it will be asked for the name enter name then we are scanning the name one by one then str length we are finding the str length and then we are allocating length plus one that is for the null character and then we are copying that particular string into the memory location strcp var after the first location that is declared by this pointer p so here we are using the pointer p and we are copying that one by one the whatever we are having that names this is the scanning or reading the names and then we are going for the printing so printing directly we are having the loop and then we are printing the names one by one whatever the read already in this program. Now we will see how to pass single string using the function now here we are having the function name it is declared void display string and here is how we are passing this string so in the declaration we have passed with the str name with the empty and then here we called the function with the display name and that we have mentioned the which string we are passing here to the function and in the function when it is start we have seen it will be same as where we are declared in the start so when it will run it will ask for the enter string then we will enter any string here hello and then it will be go into the function and then it will be printing that whatever given string now how the pointer is useful in the string we will see one example how the pointer works so here we are having this stdio.h this is the main function and we are having harry potter as a string in the memory location which is stored on the name name now in the first we have seen this is the single character we are printing where our pointer is started at the name so in the pointer name the content is there is h so our pointer is pointing to the h so a single character it will print in this case will be h and then next we will go our pointer is incremented by one so it will moving to the a so pointer is moving to the a so the output is automatically it is giving a now next our pointer is incrementing name plus seven so it is reaching to the o to that particular place so the pointer which is pointing that character it will be the output so here we are having the string and the pointer we are trying that pointer one more time by changing the pointer name here we are giving name pointer and here name pointer is nothing but whatever we are used this area of the character name so name that is name pointer is equal to name so whatever the contents of the name will be allocated to the name point so again we are trying with the help of instead of name name pointer so we are having the same output here so for name start h then pointer is incremented by one it will be a and then when we are incrementing by seven it will be o so some more about the strings how the string works so here we are having string hello which is stored into the array and second string we are having the array of 10 so here we are having pointer and it is allocated at the start of this string good morning one more pointer is there q so here str2 is equal to str1 if we are going to give like integer a is equal to b it will not work it will give the error we can't allocate first string to another string as it is so we cannot assign a string to another so it is a wrong way if we are working with the pointer to the string so the pointer will be q now it will be allocated to the s then it will work so string cannot be assigned to another string for assigning one string to another string we have to use pointer so here I have shown this without pointer and with pointer how this is the wrong way and this is the correct way there or one more point is there in the string here we are having str1 hello and p that is the pointer is allocating to the start of the hello now this string directly if I am writing string one is already hello and if I am writing another string by then it will give error so once a string has been defined it cannot be initialized to another setup to assign then we have to go for the pointer which is allocating hello first and then here that pointer is assigned with the by so it will take in the program and it will work now pause the video for some time and match the output of given statement now here the program is there main and we are having s which is having the string gate organized learn c and we are having four print statement in first we are giving the address of string at two then we are printing that string then again we are giving the address of that string and here again the pointer is moving to the second so here I have given different answers and you have to match that answers so this is the solution see in the first print we are at the address of this particular string at location 012 so at t we will start our string at t we will start our string and whatever the next we will print as it is in the second we are having simple string printing so it will total string will be printed with the help of print statement and in the third we are given start address of the string so here this will work same as this so here we are using pointer and here directly the string is going to be print so it will be again print gate organized learns in the last instead of s we are printing c so and we are at location 2 so single character where we are here at the gate t so that t only t will be going to be print references thank you