This quiz is meant to give you an idea of how well you understand the material regarding functions and parameters. Your performance on this quiz does not affect your grade in the course; it is meant only to provide feedback to you about how you're doing.
void oberon( int n , int m ) ;
main()
{
int x = 5 ;
int y = 7 ;
oberon( x , y ) ;
printf( "%d %d\n" , x , y ) ;
oberon( x , y ) ;
}
void oberon( int a , int b )
{
int c ;
a *= 2 ;
b *= 2 ;
c = a ;
a = b ;
b = c ;
}
float titania( float thisbe , float pyramus ) ;
int puck( float *lysander , float *hermia ) ;
main()
{
float x = 1.3 ;
float y = 3.0 ;
float z = 9 ;
float *px ;
float *py ;
float *pz ;
px = &x ;
py = &y ;
pz = &z ;
z = titania( x , y ) ;
if ( puck( px , py ) )
printf( "%f %f %f\n" , x , y , z ) ;
else
printf( "%f %f %f\n" , z , y , x ) ;
printf( "%f %f\n" , z , *pz ) ;
}
float titania( float demetrius , float helena )
{
return demetrius * helena ;
}
int puck( float *lysander , float *hermia )
{
int bottom ;
bottom = *lysander ;
*lysander = *hermia ;
*hermia = bottom ;
return ( (*lysander) > (*hermia) ) ;
}
Solutions:
Copyright © 1999, Ray Ontko (rayo@ontko.com).