Program Question
Bryce C
plug-devel@lists.PLUG.phoenix.az.us
Mon Jan 6 16:23:02 2003
--=-GsO0pbs1MlrfuP68nF4G
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Can anyone tell me why there is always a segfault at the end of this?
<!-- Starting -->
#include <iostream.h>
using namespace std;
int main(int argc, char *argv[])
{
if(argc<2)
{
cout << "Don't waste my time!\n";
return(1);
}
for(int i=3D1; i<=3D argc; i++)
cout << argv[i][0] << ": " << int(argv[i][0]) << '\n';
return (0);
}
<!-- Ending -->
./src/ch h f
h: 104
f: 102
Segmentation fault
--=20
Bryce C <Plug@BryceCo.Net>
CoBryce Communications
--=-GsO0pbs1MlrfuP68nF4G
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQA+Gg07/wbq/C6yyPcRArITAJ9swGu6K/h0IjTvPgAQpgvuY9F8ygCgiI3O
NxAvu5osMQv37iJmUDicy/M=
=Jrrr
-----END PGP SIGNATURE-----
--=-GsO0pbs1MlrfuP68nF4G--