#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
int count =9;
int *countaddr = & count;
*countaddr =10;
printf("%d\n",count);
printf("%d\n",*countaddr+1);
return 0;
}
=========================
#include <stdio.h>
#include <stdlib.h>
void pass(int *a)
{
*a=*a+1;
}
int main(int argc, char *argv[])
{
int a=3;
pass(&a);
printf("%d",a);
return 0;
}
==========================
#include <stdio.h>
#include <stdlib.h>
void pass(int *a,int *b)
{
int t=*a;
*a=*b;
*b=t;
}
int main(int argc, char *argv[])
{
int a=1,b=2;
pass(&a,&b);
printf("%d %d",a,b);
return 0;
}
沒有留言:
張貼留言