C Language Quick Learning notes 001-related grammar __c language

Source: Internet
Author: User
-> is called the indirect reference operator in the C language, and is a two-mesh operator, with the precedence of the member operator ".".
usage:
p->a, where p is a pointer to a struct body, and a is a member of this struct type. The expression P->a refers to member A of the struct that the pointer p points to.
For example:
struct T
{
int A;
Char b;
}s;

struct t* p=&s;
So
P->a is equivalent to S.A.
Obviously, there is an equivalent notation: (*p). A, and P->a is exactly equivalent. ---------------------------
The use of 2.&

1. Take the address. Monocular operator. The address used to take a variable.

Like what

1 2 int I, *p; p = &i; The & function here is to take the address of the variable i.
3.:: The role:
Representing scopes, and owning relationships
Like what
Class A
{
Public
int test ();
}

int a::test ()//indicates that test belongs to a
{
return 0;
}

Similarly, there are other things that are not listed
--------------------
Like what
int A;

void Test ()
{
int a =:: a;//with global variable A, assign value to local variable a
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.