Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > A problem about...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 7 Topic 43781 of 48022
Post > Topic >>

A problem about char pointer ?

by "comp.lang.c++" <cnhenuake@[EMAIL PROTECTED] > Mar 10, 2008 at 08:00 AM

this is a sample example about this question
#include<stdio.h>
void chg(char* t)
{
    char *s=t;
    char p=*t;
    while(*t++=*++s);
    *--t=p;
}
int main()
{
   //char * t="abcde";
   char t[]="abcde";
   chg(t);
   printf(t);
   printf("\n");
   return 0;
}
I want know why the function chg() cann't work when define t with
char*, and what's the different
between char* and char[]?
thanks?
 




 7 Posts in Topic:
A problem about char pointer ?
"comp.lang.c++"  2008-03-10 08:00:40 
Re: A problem about char pointer ?
"Victor Bazarov"  2008-03-10 11:14:34 
Re: A problem about char pointer ?
"Jim Langston"   2008-03-10 14:06:10 
Re: A problem about char pointer ?
Paul Brettschneider <p  2008-03-10 23:57:41 
Re: A problem about char pointer ?
"comp.lang.c++"  2008-03-10 18:27:25 
Re: A problem about char pointer ?
"Jim Langston"   2008-03-12 18:06:51 
Re: A problem about char pointer ?
Triple-DES <DenPlettfr  2008-03-10 22:54:51 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 14 11:31:13 CDT 2008.