Hi every rental in this lesson we are going to study this new topic strings.
So for example you want to store something like this.
So this is actually a string.
This is an example of a string.
So this thing cannot be stored in any integer Eddie we cannot stored the string hello inside it in detail.
So what do we need.
We need a one day mission.
Correct Barry.
So what is the difference between integer and connectivity.
So everything will look very similar.
So let's say you want to create an NDA area of size 10.
So what will happen so this will be your index as you do and the last index will be index nine.
And how much space.
So for storing when digit I need four bytes.
So the suspend.
So the space will be 40 bytes.
Now similarly how can you call it connectivity.
So I will write correct.
Any of that it be and let's say the size is 10.
So what will happen again.
Very similar.
The Fostering mix is 0 and the last index is 9.
And for storing one character I need one byte so this total is actually 10 bytes only.
So everything is working quite similar.
Now let's see the defense whether defense will come.
So if you want to take input in beta what you will do.
So first of all you will take how many elements you want to take input.
So you will write to CNN and basically then you will use a for loop.
So then I equals zero I list and and I bless plus and you will do something like this scene if I.
So this is for taking input inside an integer area.
Now how we will take input inside correct.
So the connector area a little bit special.
So if you will write C in the name that is B.
So it will write CMB.
So this will actually work.
You do not have to use for loop for the character that is seen we work specially scene will work differently
for connectivity.
So what you can do if you like scene B and if you give then Butler took coding.
So what will happen this coding will get stored in this C or B I N N G you do not have to use for loop
for taking input inside you for taking input for the correct battery.
So that's why I regret a little bit special now for printing the.
Now for printing the content of the edit what you will do.
Again you have to use a for loop so equals zero i.e. less than N I plus plus and you will write something
like this C out of I know this thing is for printing the content of the area.
So this is for and ready and for correct Barry.
Again that things will work a little bit differently.
So what will happen.
You can likely write see out B if you will write the old then what will happen to the content of that
it will get printed.
So that will put will be according so seen and see out there working differently for the correct baddie
because the correct word is a little bit special now.
Now let's see again how can we take and putting corrected.
So you are creating a baddie.
Let's say the size is 10.
So again what will happen.
This will be your index 0 and your last read next will be the next 9.
Now if you will write CMB and let's say you give the input coding so how coding will get stored.
So this is C then 0 then B then I then n then G.
So it will not stop here.
So what will happen scene scene is working differently for character.
So after you give the input what will happen a null character will get automatically appended.
So this is big zero and takes one two three four and five.
So at index six this null corrector we get appended automatically.
So we call.
So what is happening.
So this null corrector we get automatically appended at the last.
And this character the name of this character is actually another character.
So this is actually a null character and it is asking value is actually zero.
So now you will be thinking What is the use of this character.
So so it looks as are Terminator
so when you will write C out to be.
So what will happen.
I will go to this index zero I will print the content so I will print c then I will print or then D.
Then I then LNG so the I n n g then what will happen I will try to print.
So what will happen.
I will reach this null character and the meaning of no good.
Those actually are terminated.
So what I will do I will stop.
So as soon as I will reach it and then I will stop printing I'm repeating myself.
For taking in pertinent time period we will write like this.
C in B and let's say you're giving according saw to happen according will get stored in this manner
and at the end another character will get automatically appended by C in.
So this is a property of the correct battery and thus no character is actually going to work as a terminator.
It's asking value is actually zero and this Terminator is going to be used when you are printing the
content of the correct baddie.
If you would like to see out what will happen you will go to the foster index basically next zero you
will print the content of the edit until you reaches this terminating character.
So as soon as you reach this new character you will stop printing as soon as we will reach this permeating
character.
We will stop printing so that's how the output is going to be according.
Okay so let's take one example so for example you are creating links in the name of field at is actually
name and let's say the size is hundred.
So what will happen.
So this is you Eddie.
This is index 0 next one index 2 so index 1 index 2 and your last index would be 99.
And this is your name Eddy correct.
Now again if you will right.
See in name and let's say you given put ABC.
So what will happen even come here.
We will come and see welcome it and I know look at it will come back in next 3 automatically.
So now you can actually be appended automatically and if you write see our name.
So what will happen.
Print a brand to be brand C and then you will reach this null character.
So stop printing so you will print a b and c now let's best bastard.
Now let's write the code so that you guys can have a better understanding so the name of the file is
click bait or TPP.
So what do we want to do.
I want to create a chaotic baddie so let's say the name let's say the new that is name actually the
size is hundred and let's take and put
enter your name
so for taking and put inside a character you can likely use scene you do not have to use a for loop
C name because correct bad.
I was a special CNN CEO to work differently from them so you would name is.
So what we'll do I will likely write she out name correct and I will write and line here.
So what should be our output.
So whatever you will enter will get printed here.
So let's test up m
let say my name is ABC the so your name is ABC.
So our Gore is working fine.
Now what is happening here.
So let's say I'm ending the name ABC.
So what did happen.
This is you're correct Barry the name of this is actually name so this the last 16 is going to be nine
game.
This is index zero this is the next one.
This is a mixed two and let's say you enter ABC.
So this is a.
This is B and this is C and automatically and know correct I will get appended at indexed 3.
Now what will happen if at indexed for I write x.
So what will happen.
So if I will then the program will this actually get printed or not.
So what I want to say if I do something like this Let's animal food.
So initially the name of food is containing a garbage value.
And if I do name all food it goes X and then I tried to write C O name.
So what should be my output.
I think my output should be ABC only because what is the proper Yossi out.
So it was starting from the first character it will read e it will print a.
Then it will print B then it will print c and then it will reach the null character was read as soon
as it will reach it and then.
I will stop printing so that's why my output is going to be ABC and not this X so this X will not be
printed so let's test our program and let's see what will happen.
So what I want to say is let's say I'm changing the food correct.
So initially the food character is null sorry.
Initially the fourth character is a garbage in garbage value.
So let's say I want to make it the oh let's say x.
So what will happen as discussed I would either Bush or ABC only.
So and but as ABC and I would output is ABC only
now what will happen if I do something like this.
So my input was ABC so I have a then B then C then then and add the fourth character default index.
I made the fourth index X so this is index 0 next one and next to index 3 and index 4.
Now if I change the value of index 3 if I write dy here.
So what I want to see if at the next three so I do next three analysts present if you will change the
third index value.
So if you will make a D and then if you will write C out the name then what should be our output.
So what will happen.
C out has a very standard property.
It was starting from the first character.
It will print a.
Then it will print B then it will print C then it will print D because this is D.
So ABC then it will print x and it will keep going on until it encounters no character.
I be reading myself after printing ABC the X it will go to index wife then it will go to index X it
will go to index 7 and it was and it will continue printing the elements and then it will not reach
the null corrected.
So as soon as it will reach an incorrect bet it will stop printing.
Otherwise it will print everything so let's see.
So what I want to do
so I want to change the title character.
So the title character was null because I'm going to insert I'm going to give in but ABC and later the
title correct is Dino Laird's best up program
so I'm going to give input.
ABC.
So this is my output.
ABC X then a special character and then.
So what is happening here.
Again very simple logic.
You give the input ABC.
So this is a then b then c and automatically and then it will be appended.
Then you change the value of nil.
So this is Dino then at default and X you put X..
So what is the property of C out.
So what should we do with name.
It will print a it will print to be it will be in C it will happen to be it will print x and it will
continue printing everything until it produce an electric bill.
So and so this is index 0 1 2 3 4 and in next 5.
So this is especially good at fighting this especially getting base presented then agent execs and misrepresent
and add index 7 my network correctly present.
So that's why it will stop.
It will print only this much part so by John's agenda it's seven connect base present.
How many can pick and be present because it is a garbage because everything is garbage so garbage values
out there.
And one of the God raised values happened to be a little character so from index 5 onwards from index
5 onwards my character is containing garbage values and add index seven by Johns the garbage value is
connected.
So that's why we stop printing at index 7.
So that's why my output is a B C D X and two special characters.
So that's how it is working.
Now if I could do one more thing.
So what I'm doing here.
So I'm giving input ABC and then I have none here.
Then if I change the value of b if I will write and here.
So what will be my output.
So let's try to test.
But am up and let's see what will be our output.
So what I want to say I'm going to change the second character.
So that means second Burmese Foster index so I want to change my first index.
So instead of B I want to make it null and then let's see what we will output
ABC.
So now output is only by only eight because it is very obvious CO2 will print only the first character
because the second character is going to be null and it will stop printing.
So what I want to say.
So enter your name you will give the value ABC and you are changing the first character to be noted.
So this is null no then you are printing the name.
So what will happen is the old will print e then see do will reach this new character.
And it will stop printing.
So that's why my output is only so that's why it is presented.
So I think you now have a good idea how good it is book.
So in the next radio we will solve a few questions so that you guys can have a better understanding.
I to do it by.