view test/call.c @ 80:83d901658ce9 indirect-call

*** empty log message ***
author kono
date Mon, 03 Mar 2003 05:41:10 +0900
parents 82d0e30f61dd
children 1ad7045741a7
line wrap: on
line source



int (*conv)(int);

a0(int i)
{
    return i+3;
}

a1(int i)
{
    return i-3;
}


a2(int i,int conv(int))
{
    return conv(i);
}

a3(int i,int (*conv)(int))
{
    return conv(i);
}

a4(int i,int conv(int))
{
    return (*conv)(i);
}

a5(int i,int (*conv)(int))
{
    return (*conv)(i);
}

main(int ac,char *av[]) {
    int j,k;
    conv = a0;
    j = conv(3);
    k = a2(4,a1);
    printf("6 1 = %d %d\n",j,k);
    k = a3(4,a1);
    printf("6 1 = %d %d\n",j,k);
    k = a4(4,a1);
    printf("6 1 = %d %d\n",j,k);
    k = a5(4,a1);
    printf("6 1 = %d %d\n",j,k);
}