Strings | C Technical Interview Questions and Answers | Mr. Srinivas

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hi everyone welcome to nourish technologies this is cinemas in this session we have to discuss 1c technical interview question so on strings concept here it is the code the code here it is we are declaring one character array so we can call it as a string also the name is a sport and here it is we are using the value is cricket and here it is next followed by so we are declaring two more variables of integer type and x value image slide and why is just declared and here with the help of modifier operators we have written one expression here expression so after evaluation the final value we are storing into Y and finally using printf function we are printing one character of a string right with a particular location so that is a plus plus y so this is how it executes means first we need to allocate the memory for this string see here is a cricket get memory allocation memory allocation see our IC ket and of course the last character is a null character null character and this is the index starts with a 0 and any base address just consider base address is a thousand here it is array variable holds the base address only the variable sport is holding the base address by which it is pointing to this string this is memory allocation each character occupies only one byte memory so next location is the 1,001 1,002 3 4 so like that memory will be allocated now here so what is the x value is 1 x value the gets memory allocation x value is 1 and y only just declaration we are not initializing with any value and of course the local variable in C language is initializes with a garbage value but garbage value is not required as of now and look at this the first unit evaluate this expression we know how to evaluate this expression using modify operators here how many pre increment and pre-decrement operators are there so that will exit you'd first is executed first so here X value plus plus X so X value become 2 X value become 2 so after increment and decrement pre increment and pre decrement operators it will substitute the values right in the expression X values it - there is no value 1 1 is already gone now in that place two came so 2 will be substituted everywhere - less - so the value is a 4 the value is 4 so that evaluated value will be stored in to Y so here the Y value is a 4 Y value is 4 and remember one more thing is the after evaluation of expression after this after assigning X value to Y so for to Y and here it is in this expression post increment is also there so please don't forget about the post increment X value is increased by 1 so X value become 3 so here x value is 2 now that will become 3 so 2 times we are increasing the x value initially 1 the 2 times you are increasing means what to become 3 and Y value is a 4 now here the control comes to that next statement here we are printing one character but here we need to substitute + + y value so Y value is 4 so plus plus y means what the value becomes 5 the 5 will be substituted spot of 5 so means what the value which is inside that location nothing but an index number is a 5 0 1 2 3 4 5 the value is a e so output of this program is e it is printing E and this expression is very very important in this program so first plus plus X execute X value become two the two will be substituted everywhere so final value become four so four will be substituted into Y and here it will increase one more time the value become Phi the fifth location character we are printing in the fifth location the character is a II so that II it will print so this is the output of this program is a hope you understood for more videos please subscribe to nourish additional thank you [Music]
Info
Channel: Naresh i Technologies
Views: 52,707
Rating: 4.8863978 out of 5
Keywords: StringsInterviewQuestions, C LanguageInterview Questions, C InterView Questions, C Language Course, C Language InterView Questions By Srinivas, ClanguageQuestions, Clangauge Techinical Interview Questuions
Id: 42DTJfzCbnk
Channel Id: undefined
Length: 5min 6sec (306 seconds)
Published: Mon May 01 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.