12 Mart 2010 Cuma

Call by Reference C Example()

//www.ethemsulan.com
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
    int topla_1(int *a,int *b,int *c);
    int x,y,z,t;
    int *px,*py,*pz;
    x=1;y=2;z=3;
    px=&x;py=&y;pz=&z;
    t=topla_1(px,py,pz);
    printf("\ntoplam=%d\n",t);
printf("\nx,y,z degerleri=%d,%d,%d\n",x,y,z);
  
  system("PAUSE");	
  return 0;
}
         int topla_1(int *a,int *b,int *c){
         *a=*a-1;
         *b=*b-1;
         *c=*c-1;
         printf("a=%d,b=%d,c=%d\n",*a,*b,*c);
         return (*a+*b+*c);    
         }

Hiç yorum yok:

Yorum Gönder