this is my sub proceedure

/******************************************************************************
 *
 * Name: patpixselect
 * Parameters: none
 * Returns: patpix[]
 * Globals:  none
 * Description: database for which pixels for which pattern
 *****************************************************************************/

int patpixselect (int pat);
{
    float patpix[9] ;       // array for pixels in patterns

    
    
    if (pat == 1)
    {
        patpix[0] = 1;
        patpix[1] = 1;    
        patpix[2] = 1;
        patpix[3] = 1;
        patpix[4] = 1;
        patpix[5] = 1;
        patpix[6] = 1;
        patpix[7] = 1;
        patpix[8] = 1;
        ++pat;
        return (patpix[9], pat)
    }
    if (pat == 2)
    {
        patpix[0] = 2;
        patpix[1] = 2;    
        patpix[2] = 2;
        patpix[3] = 2;
        patpix[4] = 2;
        patpix[5] = 2;
        patpix[6] = 2;
        patpix[7] = 2;
        patpix[8] = 2;
        ++pat;
        return (patpix[9], pat)
    }
    if (pat == 3)
    {
        patpix[0] = 3;
        patpix[1] = 3;    
        patpix[2] = 3;
        patpix[3] = 3;
        patpix[4] = 3;
        patpix[5] = 3;
        patpix[6] = 3;
        patpix[7] = 3;
        patpix[8] = 3;
        pat = 1;
        return (patpix[9], pat)
    }
    
}

will this work? will i need to declare the array before i call the sub proceedure and can i return both those pieces of info?

the array needs to be a float because the numbers wont be integers when i go to run the program properly.
"pat" is declared before it enters the function, and its number dictates which array values are used in the main program. not sure whether it is needed to be returned unless pat being incrimented isnt recognised in main program, also pretty sure now that pat shouldnt be in that return bracket

im not sure if this is correct
the values of the array is the important thing

this is my sub proceedure

/******************************************************************************
 *
 * Name: patpixselect
 * Parameters: none
 * Returns: patpix[]
 * Globals:  none
 * Description: database for which pixels for which pattern
 *****************************************************************************/

int patpixselect (int pat);
{
    float patpix[9] ;       // array for pixels in patterns

    
    
    if (pat == 1)
    {
        patpix[0] = 1;
        patpix[1] = 1;    
        patpix[2] = 1;
        patpix[3] = 1;
        patpix[4] = 1;
        patpix[5] = 1;
        patpix[6] = 1;
        patpix[7] = 1;
        patpix[8] = 1;
        ++pat;
        return (patpix[9], pat)
    }
    if (pat == 2)
    {
        patpix[0] = 2;
        patpix[1] = 2;    
        patpix[2] = 2;
        patpix[3] = 2;
        patpix[4] = 2;
        patpix[5] = 2;
        patpix[6] = 2;
        patpix[7] = 2;
        patpix[8] = 2;
        ++pat;
        return (patpix[9], pat)
    }
    if (pat == 3)
    {
        patpix[0] = 3;
        patpix[1] = 3;    
        patpix[2] = 3;
        patpix[3] = 3;
        patpix[4] = 3;
        patpix[5] = 3;
        patpix[6] = 3;
        patpix[7] = 3;
        patpix[8] = 3;
        pat = 1;
        return (patpix[9], pat)
    }
    
}

will this work? will i need to declare the array before i call the sub proceedure and can i return both those pieces of info?

the array needs to be a float because the numbers wont be integers when i go to run the program properly.
"pat" is declared before it enters the function, and its number dictates which array values are used in the main program. not sure whether it is needed to be returned unless pat being incrimented isnt recognised in main program, also pretty sure now that pat shouldnt be in that return bracket

im not sure if this is correct
the values of the array is the important thing

You have some semicolon problems and you have a potential segmentation fault. Why are you using the comma operator? If you are trying to return an array:

* Returns: patpix[]

then change the function so it returns a pointer to an array instead of an integer:

int* patpixselect (int pat);

See this thread:
http://www.daniweb.com/forums/thread5939.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.