Journal Articles
Browse in : |
All
> Journals
> CVu
> 122
(18)
All > Journal Columns > LettersEditor (132) Any of these categories - All of these categories |
Note: when you create a new publication type, the articles module will automatically use the templates user-display-[publicationtype].xt and user-summary-[publicationtype].xt. If those templates do not exist when you try to preview or display a new article, you'll get this warning :-) Please place your own templates in themes/yourtheme/modules/articles . The templates will get the extension .xt there.
Title: The Wall
Author: Administrator
Date: 08 March 2000 13:15:36 +00:00 or Wed, 08 March 2000 13:15:36 +00:00
Summary:
Body:
Dear Francis,
I have attached an attempt at the eliminate() function which does not use break or call another function. The code is based on the code submitted by Anthony Hay (C Vu 12.1 p11) but effectively replacing the strchr call with an inline equivalent. The bitmap creation and exploitation code is standard, but not especially intuitive. If you work through it, you can convince yourself that it works.
Catriona O'Connell <catriona38@hotmail.com>
#include <stdio.h> char *eliminate(char const these[] , char from[]); int main(){ char myname[] = "Catriona Siobhan O'Connell"; const char vowels[] = "aeiouAEIOU"; puts(myname); eliminate(vowels,myname); puts(myname); return 0; } char *eliminate(char const these[] , char from[]){ // Purpose: Remove specified characters from a // string. At entry char const these[] lists // the characters to be removed and char // from[] is the string to be processed. At // exit from[] contains the characters not // removed. char *src = from; char *dst = from; unsigned char map[32]; int count; // Create a bit map with a bit set on for each // unique character in the these[] string. for (count=0;count<32; count++) map[count]= 0; while (*these){ map[*these >> 3] |= (1 << (*these & 7)); these++; } // For each character in from[], check if the // corresponding bit is set in the bitmap. If // it is advance to the next character, // otherwise, copy the character to a // (potentially) new position for output. while (*src){ if(map[*src >> 3]&(1<<(*src & 7))) src++; else *dst++ = *src++; } // Add a terminating NUL. *dst = '\0'; return from; }
Notes:
More fields may be available via dynamicdata ..