c++ - Why char array and int array get printed as different things? -


this question has answer here:

int main () {     int intarr [5] = {1,6,7,9,3);     char charr [7] = "avneet";     std::cout << intarr << "\n";     std::cout << charr << "\n";     return 0; } 

the first line program prints memory address , second line, whole string (avneet). what's making difference? 1 more question. in int case, address what? address of entire array or address of first element of array.

std::basic_ostream<> has overloads of operator<< char const* , signed/unsigned versions expect c-style zero-terminated string.

and void const* overload used other pointer types , outputs address.


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -