2 bài tập cơ bản mô tả biến con trỏ
k4info :: Khu vực học tập :: Học Tập
Trang 1 trong tổng số 1 trang
2 bài tập cơ bản mô tả biến con trỏ
#include
#include
int main()
{
clrscr();
int i1,i2,*p1,*p2;
i1=5;
p1=&i1;
i2=*p1/2+10;
p2=p1;
printf("i1=%d,i2=%d,*p1=%d,*p2=%d\n",i1,i2,*p1,*p2);
getch();
return 0;
}
#include
#include
int main()
{
clrscr();
struct date {int t,ng,n;};
struct date hnay, *hwa;
hwa=&hnay;
hwa->t=4;
hwa->ng=21;
hwa->n=1990;
printf("Ngay hom nay la %d/%d/%d.\n",hwa->ng,hwa->t,hwa->n%100);
getch();
return 0;
}
#include
int main()
{
clrscr();
int i1,i2,*p1,*p2;
i1=5;
p1=&i1;
i2=*p1/2+10;
p2=p1;
printf("i1=%d,i2=%d,*p1=%d,*p2=%d\n",i1,i2,*p1,*p2);
getch();
return 0;
}
===============================================================================
#include
#include
int main()
{
clrscr();
struct date {int t,ng,n;};
struct date hnay, *hwa;
hwa=&hnay;
hwa->t=4;
hwa->ng=21;
hwa->n=1990;
printf("Ngay hom nay la %d/%d/%d.\n",hwa->ng,hwa->t,hwa->n%100);
getch();
return 0;
}
k4info :: Khu vực học tập :: Học Tập
Trang 1 trong tổng số 1 trang
Permissions in this forum:
Bạn không có quyền trả lời bài viết
|
|