+ 2

How does this output comes?😰

I know why does the first output come like this(i.e a : 9). But I won't know how does the second output comes? (i.e b : 18)😅 https://code.sololearn.com/c67TE15mvpNB/?ref=app

10th Sep 2020, 9:00 AM
Yogeshwaran P
Yogeshwaran P - avatar
4 odpowiedzi
+ 2
Nasif Rahman thanks😊 But I want to know what happened on my second output......😅 How does it output b : 18? When I won't add the null character"\0" at the end... Can you explain me.....?😅
10th Sep 2020, 9:09 AM
Yogeshwaran P
Yogeshwaran P - avatar
+ 1
Here is comment from the lesson Nasif Rahman linked ,I am adding it here so others will get an idea of what might be happening, It is by @Deepak R printf for string prints till it finds the \0 delimiter. As array is in continuous memory locations, it goes on to the previous variable in the stack ie a, which luckily had \0 termination. Hence the output. As pointed out by others you should also add \0 at the end of vowels and increase the size of vowels to 6
10th Sep 2020, 9:28 AM
Abhay
Abhay - avatar
+ 1
Thank you Nasif Rahman 😊
10th Sep 2020, 9:56 AM
Yogeshwaran P
Yogeshwaran P - avatar
+ 1
Nasif Rahman 😁😄✌👍
10th Sep 2020, 9:59 AM
Yogeshwaran P
Yogeshwaran P - avatar