code_junkie

Why does cout print char arrays differently from other arrays

Nov 14th, 2011
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. int main() {
  2. int arr[10] = {1,2,3};
  3. char arr2[10] = {'c','i','a','o',''};
  4. cout << arr << endl;
  5. cout << arr2 << endl;
  6. }
  7.  
  8. cout << static_cast<const void*>(arr2) << endl;
  9.  
  10. cout << &arr2 << endl;
Add Comment
Please, Sign In to add comment