search and edit function no copy paste?
<p>Hi this code is just an example of what im working on. I've got the solution by copying everything from my search function and dump it into my edit function. Is there any better solution rather than just copy pasting?</p>

<pre><code> struct inventory
    {
        float a,b,c,d;
        char something[MAXSIZE];
    };
typedef struct inventory Inventory;
</code></pre>

<p>struct will contain some float integer and some characters.</p>

<pre><code>void search(const Inventory inv[], int np); // declare search function
void edit(struct inventory inventoryRegister[],int np);

int main(void)
    {

        int np=0;
        struct inventory inventoryRegister[MAXSIZE];


// calling the functions search and edit

            search(inventoryRegister, np);
            edit(inventoryRegister, np);

        return 0;
        }

void search(const Inventory inv[], int np)
{
     int i, 
     float min, max;

     printf("Enter min max");
     scanf("%f %f", &amp;min, &amp;max); 

     for (i = 0; i &lt; np; i++)
        if (inv[i].a &gt;= low &amp;&amp; inv[i].a &lt;= high)
             {
                     print..
                 }
    //repeat for b,c,d and something
    }

void edit(struct inventory inventoryRegister[],int np)
{
      int a;
      print("Enter new a");
          scanf("%f", &amp;a);

    // Here i can copy and paste  my entire search function and do a loop to replace the min &amp; max with my new input a. 
But is there any easier way to do it? say i call the search(); and somehow extract the elements between min &amp; max and do a loop replacement with a? 
Any suggestion?


    }
</code></pre>