( - >)箭头操作符在c中做什么

时间:2017-02-10 03:57:22

标签: c

当我在C中的链表上编码时,我对单个程序中箭头操作符的各种使用感到困惑。 任何人都可以在深入了解这个算子吗

1 个答案:

答案 0 :(得分:-1)

每当我们使用指针访问结构的成员时,我们使用箭头操作符来访问结构的成员。

示例程序:

#include <stdio.h>
int main(int argc, char *argv[])
{

struct student_database {
    char name[10];
    int roll;
    int marks;
}stud1 = {"Pritesh",90,90};

struct student_database *ptr;
ptr = &stud1;

printf("Roll Number : %d",(ptr)->roll);
printf("Marks of Student : %d",(ptr)->marks);

return 0;
}
相关问题