1. Parameter Indexing
Void fun (int A [], int size) {printf ("Size: % d \ n", size);} 2. array reference transfer method (Disadvantage: the real parameter array size must match the type parameter)
Void fun1 (INT (& A) [1, 100])
{
Printf ("Size: % d \ n", sizeof ());
Printf ("********* fun1 ******* \ n ");
}
3. Function template with reference
Template <int size>
Void fun2 (INT (& A) [size])
{
Printf ("Size: % d \ n", sizeof );
Printf ("Size: % d \ n", size );
Printf ("********* fun2 ****** \ n ");
}
4. Extended Function template method with reference type
Template <typename T, int size>
Void fun3 (T (& A) [size])
{
Printf ("Size: % d \ n", sizeof );
Printf ("Size: % d \ n", size );
Printf ("********* fun3 ****** \ n ");
} 5. Function template method without reference
Template <int size>
Void fun4 (int A [size])
{
Printf ("Size: % d \ n", size );
Printf ("********* fun4 ****** \ n ");
}
6. Extended Function template method with reference type
Template <typename T, int size>
Void fun5 (t a [size])
{
Printf ("Size: % d \ n", size );
Printf ("********* fun5 ****** \ n ");
}