Hi,

1) As I understand from Mark - this is exactly the meaning : to increment each character of the
string (sounds reasonable; we could use just printf if we want to print the string as it is).


2) Mark Said
I'm sure there's probably a more compact way of coding it...

I think there are several ways : one heuristic (avoiding the foo variable) which works is:
....
while( *strptr)
{
printf("%c",((char)*strptr)+1);
++strptr;
}
}


....

and the output will be :

Uijt!jt!b!uftu!tusjoh

which is the orig string after increment each character of the string.

Regards,
Amir



From: "Gottfried Szing" <[EMAIL PROTECTED]>
To: [email protected]
Subject: Re: [SLUG] GCC question
Date: Mon, 18 Apr 2005 14:24:43 +0200 (CEST)

hi guys

>    while( *strptr)
>        {
>         char foo=*strptr;
>         printf("%c", ++foo);
>         ++strptr;
>        }

isn't the "++" before the foo-var wrong? AFAIR this increments the value
before it is supplied tot the printf-function, isnt it? shouldnt be just
the unmodified foo supplied?

cu


-- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to