Home TechnologyProgramming Subscribe to RSS
 

What Is The Use Of . Operator In Srtucture?

Answer Question

1 Answer - Sort by: Date | Rating

    The .dot operator in structure is used to access the data members of a structure for reading/writing purposes. By using .dot operator the programmer is calling the data member of a structure. Since structure is a collection/container of variables not just a simple variable therefore the data member that the programmer wants to access is specified after the .dot operator. The structure may contain character, integer, strings, and pointers in short every type of variable that is supported in a programming language.
    If the .dot operator is not used the compiler will not know about the variable programmer wants to access.
    In order to understand the concept of .dot operator let's have a short example;
    Struct personal
    {
    int age;
    char[20] name;
    int tel_no;
    char[100] postal address
    };
    It's a structure that has got four member variables, i.e age, name, tel_no and postal address. If the programmer wants to access the age variable of a structure personal s/he will use the following statement'
    Personal.Age
    Similarly if the programmer is referring to the tel_no of a person the following statement will access the structure personal data member tel_no
    Personal.tel_no
    0 0

    Blues 

    answered 3 years ago

      Answer Question - Answers are editable for 5 min.

      If you do not Sign-in or Register your answers will be anonymous,

      your answers may also be checked before going online.

      More

      More

         
         

        Ask a Question via Twitter

        Send a question to @askblurtit and we will publish it online and send you a reply everytime you receive an answer.

        Blurtit Store

        Get T-shirts, hoodies, caps and more at the Blurtit store

        Blurtit International