What Makes Cout

First look at this: Compiler Explorer - C This is the code generated by your compiler for the first example. The entire array has been stored in the executable .asciz "hello. To std::cout, this appears as a char*, a null terminated array.

Now look at this, which is the code generated for your second example: Instead of using the whole array of characters, we get mov byte ptr rsp 7, 104. 104 is the ASCII code for h.With *hello, you de-referenced the char* to hello. Therefore, by definition, we get the first character pointed by this pointer (to a string literal) which is h.

However, this doesnt explain why we got 104 as shown above: The compiler knows the exact control flow here, and has constant folded h upwards

• Other Questions

How is the situation in Aizwal, Mizoram after the "Hello China, bye bye India" protests?

The Situation is surprisingly peaceful unlike in Manipur where their protests are more violent. After the protests there were no harm done and people simply went back home. What was even more surprising was the unity of the people and how no one was injured or acted violently. Schoolchildren came to help with the protests.It is probably because the people and the younger generations are not so stupid anymore and they know what the Govt. of India is trying to do can cause a serious harm to the culture of Mizoram.

What will happen later is still not clear, and the protests might be continued, however with the start of the new year and the case of this happening, we are in for a very wild ride this year.Hope this Helps


How do I print the reverse the multiword string in the C language input "Hello DHRUV" and output "DHRUV HELLO"?

U can try as shown below#include #include #define MAX_SIZE 100 / Maximum string sizeint main() char str100, reverse100;int len, i, index, wordStart, wordEnd;printf("Enter any string: ");gets(str);len strlen(str);index 0; / Start checking of words from the end of stringwordStart len - 1;wordEnd len - 1;while(wordStart > 0) / If a word is foundif(strwordStart ' ') / Add the word to the reverse stringi wordStart 1;while(i

hello related articles
Tips to Help You Design the Perfect Solar Battery for That Party
Functional Features and Application Introduction of TG452 Series Intelligent Street Lamp Gateway
What Is the Best the Best Solar Street Light for You? - the Best Solar Street Light Reviews
IGBT of Fuji Motor Electronic Equipment Technology
Is a Metal Roof Right for You | Billy

Copyright © 2020  Shandong Abusair Agricultural Machinery Co,. Ltd- |  Sitemap

Multifunctional farm Abusair machinery  |  Tea Professional Cultivator farm machinery