Toms
09-06-2001, 12:00 PM
Thanks a lot.
but i still dont know what you mean "typedef void (*COPY)(...)
also , i want to know
**
void copy1(char *s1 , const char *s2)
{
while(*s2 != '\0')
{
*s1 = *s2 ;
s1++;
s2++;
}
// choose one of them only
>> *(s1++) = '\0' ; // print "12345678"
>> *(++s1) = '\0' ; // print "12345678" plus a binary code
}
**
why the last coding *(++s1) = '\0' will print "12345678" plus a binary code
what i want just to print "12345678"
Thanks a lot
Toms
"www.exontrol.com" <mike@exontrol.com> wrote:
>
>You need typedef void (*COPY)( ... )
>
>Mike
>www.exontrol.com
>"Toms" <tomsng@sinaman.com> wrote:
>>
>>what wrong about the following coding.
>>
>>void copy1(char * , const char *) ;
>>int main()
>>{
>> char string1[10] , string2[] = "12345678";
>> copy1(string1,string2)
>> cout << "string1 is " << string1 << endl;
>> return 0 ;
>>}
>>
>>void copy1(char *s1 , const char *s2)
>>{
>> while(*s2 != '\0')
>> {
>> *s1 = *s2 ;
>> s1++;
>> s2++;
>> }
>> // choose one of them only
>> *(s1++) = '\0' ; // print "12345678"
>> *(++s1) = '\0' ; // print "12345678" plus a binary code
>>}
>>
>>Can anyone help me about this.
>>Thanks a lot
>>Toms
>>
>>
>
but i still dont know what you mean "typedef void (*COPY)(...)
also , i want to know
**
void copy1(char *s1 , const char *s2)
{
while(*s2 != '\0')
{
*s1 = *s2 ;
s1++;
s2++;
}
// choose one of them only
>> *(s1++) = '\0' ; // print "12345678"
>> *(++s1) = '\0' ; // print "12345678" plus a binary code
}
**
why the last coding *(++s1) = '\0' will print "12345678" plus a binary code
what i want just to print "12345678"
Thanks a lot
Toms
"www.exontrol.com" <mike@exontrol.com> wrote:
>
>You need typedef void (*COPY)( ... )
>
>Mike
>www.exontrol.com
>"Toms" <tomsng@sinaman.com> wrote:
>>
>>what wrong about the following coding.
>>
>>void copy1(char * , const char *) ;
>>int main()
>>{
>> char string1[10] , string2[] = "12345678";
>> copy1(string1,string2)
>> cout << "string1 is " << string1 << endl;
>> return 0 ;
>>}
>>
>>void copy1(char *s1 , const char *s2)
>>{
>> while(*s2 != '\0')
>> {
>> *s1 = *s2 ;
>> s1++;
>> s2++;
>> }
>> // choose one of them only
>> *(s1++) = '\0' ; // print "12345678"
>> *(++s1) = '\0' ; // print "12345678" plus a binary code
>>}
>>
>>Can anyone help me about this.
>>Thanks a lot
>>Toms
>>
>>
>