Re: char array question
From: Mabden (mabden_at_sbc_global.net)
Date: 08/07/04
- Next message: NoTell Motel: "Re: C/C++ compiler that will work with Atmel STK500"
- Previous message: jbutler67_at_yahoo.com: "Re: Tic Tac Toe using recursion"
- In reply to: ali: "char array question"
- Next in thread: johnny_at_n0sq.net: "Re: char array question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 07 Aug 2004 02:03:20 GMT
"ali" <tj@raha.com> wrote in message
news:t328h0tkrhhe8al9g1hp8td5ascnij7vmv@4ax.com...
> Hi,
>
> I'm having a problem understanding the reason for output on the
> following code:
>
> #include <iostream.h>
>
> int main()
> {
>
> char array[]={'w','e','l','c','o','m','e'};
>
> cout<<array<<endl;
>
> return 0;
> }
>
> When i run this, the output is something like this:
>
> welcomeŚ+ ?
In addition to what everyone else will tell you, I'd like to add that C
strings must be terminated by a null ('\0'). Just in case that message
doesn't get through.
-- Mabden\0
- Next message: NoTell Motel: "Re: C/C++ compiler that will work with Atmel STK500"
- Previous message: jbutler67_at_yahoo.com: "Re: Tic Tac Toe using recursion"
- In reply to: ali: "char array question"
- Next in thread: johnny_at_n0sq.net: "Re: char array question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|