-
November 30th, 2011, 09:59 AM
#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;
-
November 30th, 2011, 11:17 AM
#2
Re: Difference between char and int arrays
Originally Posted by Igor Yalovecky
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|