Software

Code Editing

The same code, as previously seen, will be reused for the following part of the introduction.

#define MAXINT 200000

int main(void) 
{
    unsigned int t=1000, k=0, l=5, pn=2; 
    unsigned int primes[t];
    primes[0]=2;
    primes[1]=3;

    while (pn < t || primes[pn] < MAXINT)
    {
        for ( k = 0; k <= pn; k++)
        {
            if (l % primes[k] == 0)
			{
                goto otog;
			}
            else 
            {
                if (k == pn)
                    primes[pn++]=l;
            } 
        }
otog:
        l += 2;
    }
    return 0;
}

Microchip Studio has a rich editor that is made even richer by Microchip and third-party plugins. Microchip Studio has an automatic code generation faculty for snippets of C source code. To use it, select and right click the part of the code you wish to enclose in a conditional structure (like for, while, if … etc.)

Using the code snippets, you can add parts to your core source. The variable names and exit conditions are parametric within the IDE in some snippets. If only one instance changes, all the instances within the same snippet will also change, as for the for loop.

Table 1. Using 'Surround With'