Results 1 to 2 of 2

Thread: Another arrary question

  1. #1

    Thread Starter
    Frenzied Member CyberCarsten's Avatar
    Join Date
    Sep 1999
    Location
    Aalborg Ø, Denmark
    Posts
    1,544

    Another arrary question

    If i have the following array char cat[500] that contains the following:

    &&&&&&&Computer&&&&&&

    How would I go about moving all but the '&' to a new array which would then looke like this:

    Computer

    ??

    I have tried tones of for loops, but can't get it right...
    razor
    Software Engineer Student, Aalborg University, Denmark
    http://www.cs.auc.dk

    My email at AUC: will get a new email soon
    My website: http://www.razorsoftware.net


    Windows XP Pro/ Gentoo Linux (Laptop)
    Windows XP Pro (Home PC)

  2. #2
    Fanatic Member twanvl's Avatar
    Join Date
    Dec 2001
    Posts
    771

    Re: Another arrary question

    This can be done with something like (pseudocode):
    Code:
    in = input char[]
    out = new char[] with the same size as in
    for each character in 'in' {
        if character!='&' {
            append character to out;
        }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width