Thread: Isolate same records from one array to another.

  1. #16
    Registered User
    Join Date
    Dec 2017
    Posts
    1,644
    You've put the second jdeStrncpy inside the inner if block, but it should be just after it.

    The algorithm can be simplified a little bit:
    Code:
        int j = 0;
        bool in_dups = false;
        for (int i = 1; i < N; ++i) {
            if (input[i] == input[i - 1]) {
                if (!in_dups) {
                    in_dups = true;
                    result[j++] = input[i - 1];
                }
                result[j++] = input[i];
            }
            else
                in_dups = false;
        }
    A little inaccuracy saves tons of explanation. - H.H. Munro

  2. #17
    Registered User
    Join Date
    Sep 2018
    Posts
    26
    CHEERS !!! Thank you ALL for your support.....That worked great...

    I was able to add some additional array elements to make it even more useful for the end user.


    FrankCLT

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Array of Records
    By leocfox in forum C Programming
    Replies: 5
    Last Post: 04-29-2012, 10:13 PM
  2. array of records -> function
    By keisx in forum C Programming
    Replies: 3
    Last Post: 10-27-2009, 10:51 AM
  3. Array of records?
    By pobri19 in forum C Programming
    Replies: 6
    Last Post: 05-03-2008, 06:34 AM
  4. dynamic array of records
    By dustyrain84 in forum C Programming
    Replies: 2
    Last Post: 01-22-2004, 08:55 AM
  5. Replies: 4
    Last Post: 10-31-2002, 04:11 AM

Tags for this Thread