#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>
#include<string.h>
struct A
{
int a;
int *pa;
//struct A a;
struct A *pstua;
};
struct B
{
int b;
struct A *pstuA;
};
int main()
{
struct B BB;
BB.b;
BB.pstuA;
BB.pstuA->a;
BB.pstuA->pa;
return 0;
}
/*
调试:
1、打断点
2、F5
*/
void Swap1(int a,int b)
{
int tmp = a;
a = b;
b = a;
}
void Swap(int *pa,int *pb)
{
int tmp = 0;
tmp = *pa;
*pa = *pb;
*pb = tmp;
}
int main()
{
//int a = 10;
//int b= 20;
//printf("%d,%d\n",a,b);
//Swap(&a,&b);
//printf("%d,%d\n",a,b);
//int a = 10;
//char c = 'g';
//char *p = (char *)&a;
//任何类型的指针 都是4个字节 前提:32位
//因为存储的就是地址号 0xff ff ff ff
printf("%d\n", sizeof(char *));
printf("%d\n", sizeof(short *));
printf("%d\n", sizeof(int *));
printf("%d\n", sizeof(double *));
}
int main()
{
int a = 10;
int *p = &a;//"*"在这里定义指针变量
/*int *p;
p = &a;*/
printf("%d\n",*p);//10
*p = 100;//"*"在这里表示解引用,间接访问符
printf("%d\n",a);//100
return 0;
}
#endif