Quiz #5

(Last Mod: 27 November 2010 21:38:40 )

ECE-1021 Home


Name:                                                             CODE:                 Section:           Date:                  

NO CALCULATORS MAY BY USED ON THIS QUIZ

int PutV_u(unsigned int n)

{

    unsigned int m;

    int i;

    int c;

 

    /* Determine how many digits there are */

    for (m = 1; n/m >= 10; m*=10 )

        /* EMPTY LOOP */;

 

    /* Print out the digits one-by-one */

    c = 0;

    do

    {

        for(i = 0; n >= m; i++ )

            n = n - m;

        PutC((char)('0' + i));

        c++;

        m = m / 10;

    } while ( m >= 1 );

 

    return c;

}

n m i c  
         
         
         
         
         
         
         
         
         
         
         
         
  1. (3 pts) Fill in the above memory map when the input is ___________ (given by instructor)

  2. What is the output for the above value? ______________

    Indicate the point in the memory map where each character is output by placing a circled number next to the last memory value that changed prior to the output - a 1 for the first output, 2 for the second output, and so on.

  3. What is the return value for the above value? ______________