dhownpnay
March 10th, 2004, 06:28 PM
how do you ignore spaces and punctuations when working with arrays?
|
Click to See Complete Forum and Search --> : ignoring punctuations and spaces when working with arrays dhownpnay March 10th, 2004, 06:28 PM how do you ignore spaces and punctuations when working with arrays? ferox March 11th, 2004, 12:12 AM Again an incomplete question. :) What I interpreted is that you want to eat some punctuation characters from the array of characters provided to you by the user. You can define a function like below to do that. I am assuming you only want to delete one character, although you can modify the code easily to delete all punctuation characters. void eatchar(char* arr,char ch) { int i = 0, j = 0; // to and from indexes while(*(arr + i) = *(arr + j++)) { if(*(arr + i) != ch) ++i; } } codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |