![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| last char from a string | broli | Shell Programming and Scripting | 6 | 12-07-2007 08:02 PM |
| replacing all 4 first upper char of every rec to lowercase ? | Browser_ice | UNIX for Dummies Questions & Answers | 2 | 08-02-2006 12:06 PM |
| string of 7 char length always... | thanuman | UNIX for Dummies Questions & Answers | 3 | 04-12-2005 12:51 PM |
| Compare Char to String | Phobos | High Level Programming | 3 | 04-09-2005 11:01 AM |
| Number of specific char in a string. | gio123bg | Shell Programming and Scripting | 7 | 12-19-2003 02:27 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
char *a="a.s"
is constant, you cannot change it. Code:
char dest[24]={0x0};
char src[24]={0x0};
char *p=NULL, *q=NULL;
for(p=src,q=dest; *p; p++)
{
if(*p=='a')
{
strcpy(q,"ant");
q=strchr(q,'\0');
continue;
}
if(*p=='s')
{
strcpy(q,"sree")
q=strchr(q,'\0');
}
else
*q++ = *p;
}
printf("%s\n", dest);
Last edited by reborg; 11-20-2006 at 02:18 PM.. Reason: fix typo that stopped the code tags from working |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|