2008秋-计算机软件基础-结构体与指针复习
//结构体与指针
#include<string.h>
#include<stdio.h>
struct student
{
int number;
char name[10];
};
void main()
{
struct student a;
struct student *ptr=&a;
a.number=10;//ptr->number=10;
strcpy(a.name,"li");//strcpy(ptr->name,"li");
printf("%d,%d ",a.number,(*ptr).number);
//(*ptr).number <=> ptr->number
}
#include<string.h>
#include<stdio.h>
struct student
{
int number;
char name[10];
};
void main()
{
struct student a;
struct student *ptr=&a;
a.number=10;//ptr->number=10;
strcpy(a.name,"li");//strcpy(ptr->name,"li");
printf("%d,%d ",a.number,(*ptr).number);
//(*ptr).number <=> ptr->number
}