|
From: Rafael C. <cha...@un...> - 2004-05-28 14:53:54
|
Hi,
I think the answers to your question were great.
Maybe it's not clear to you that we can have
int, float, double, char and other data types
arrays, **but when it comes to char arrays,
things are different**.
The point to consider is: there are things you
can do only with char arrays and pointers and
I/O functions (e.g. cout) can demonstrate that.
Suggestion: read more about C strings (not C++ "string" type).
Google: c array pointers (returns a lot of sites)
Hope this helps you.
Rafael
Noorez Kassam wrote:
> I have asked questions about pointers and arrays but all the answers are
> not that great. Maybe I was unclear so I will explain my questions
> better...
> first...
>
> int main()
> {
> int nArray[5]={1,2,3,4,5};
> cout << nArray << endl;/*this gives the address of the array*/
> char sArray[6]={'h','e','l','l','o',\0};
> cout << sArray << endl;/*this give the string hello, but i used the
> name of the array without subscripts? Don't i get the address of it
> like in the int array?*/
>
> char* pszString = "hello";/*strangest of all*/
> /*this looks as if you were trying to put "hello" where the address of
> a char would go.*/
>
> char String[] = "hello";
> char *pszString2 = String;/*looks less confusing because the address
> of the array would get assigned to 'pszString2' because of using the
> name of the array without a subscript, but still is confusing because
> cout the name of the char array without subscripts gives you the string*/
>
> _________________________________________________________________
> MSN Premium includes powerful parental controls and get 2 months FREE*
> http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: Oracle 10g
> Get certified on the hottest thing ever to hit the market... Oracle 10g.
> Take an Oracle 10g class now, and we'll give you the exam FREE.
> http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|