why we update char array ( char by char ) instead of putting whole string once ? i have seen this in the videos but i didnt understand why is he doing that
Oops general doubt
@sktg99 Yes, we can definitely use a string, but to make the students more comfortable with character arrays and the use of β\0β that procedure has been followed in the video.
If you feel comfortable with character arrays you can use the string class by all means.
Hope this helps.
its not about string class, I think u didnt get my point
im asking why cant we declare C.name=βBMWβ directly instead of declaring individual characters(like C.name[0]=βBβ and so on)
You can declare that way as well, there is no problem in that.
Some students face problem visualizing character array as a string, it for them that the has been made like that, else I donβt see any issue in directly declaring the whole array.
okay thank u very much
1 Like