Difference between char and int arrays
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Difference between char and int arrays

  1. #1

    Difference between char and int arrays

    Why second works, but first givws segmentation fault?

    char s2[] = {49,49,0};
    char **pch = (char **)&s2;
    cout << *pch << endl;

    int i[] = {10101,2};
    int **pi = (int **)&i;
    cout << *pi << endl;

  2. #2
    Join Date
    Apr 1999
    Posts
    27,418

    Re: Difference between char and int arrays

    Quote Originally Posted by Igor Yalovecky View Post
    Why second works, but first givws segmentation fault?
    Neither one "works". In C++, there is no guarantee that when you do something foolish, the application will crash.

    Regards,

    Paul McKenzie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center