Home > Back-end >  C language pointer variable is presupposed
C language pointer variable is presupposed

Time:11-25

Why this program will be executed?

CodePudding user response:

No problem, is to the pointer assignment, 5, 8 address, the building Lord didn't do to 5, 8 corresponding memory read and write operations? Just a pointer addition and subtraction, similar to common variable addition and subtraction ~

CodePudding user response:

You write code,
The machine understanding is 0, 1
The middle there is a call to the compiler translate your code to machine for you,
Compiler is the difference between a pointer, int, machine the pointer and int't difference between

CodePudding user response:

reference 1/f, confident boy reply:
will be a problem, is the pointer assignment, 5, 8 address, the building Lord didn't do to 5, 8 corresponding memory read and write operations? Just a pointer addition and subtraction, similar to common variable addition and subtraction ~

Why is equal to zero in the end

CodePudding user response:

refer to the second floor response: thousand dreams life
you wrote code,
The machine understanding is 0, 1
The middle there is a call to the compiler translate your code to machine for you,
Pointer, int is the difference between a compiler, the machine needle and int no difference between

Say the shallow point bai still don't understand

CodePudding user response:

Two Pointers is presupposed significance lies in the fact that assumes that they point to the same different elements in the array, after the subtraction, get two elements subscript difference,

CodePudding user response:

Is, Pointers in computer with int't seemed to be no difference, the only difference is that you specify a pointer, it is so, the computer will listen to you of the value of an int as a address

CodePudding user response:

references of the dream life (6th floor response:
, that is, a pointer on a computer with int't seemed to be no difference, the only difference is that you specify that it is a pointer, then the computer will listen to you of the value of an int as a address

To describe is: you can think of a pointer is an int [with int the same], but it is called a pointer, you so, computers allow you to (*) way to bring the int value as the address access to data,

CodePudding user response:

reference sunjianan2020418 reply: 3/f
Quote: reference 1/f, confident boy reply:
will be a problem, is the pointer assignment, 5, 8 address, the building Lord didn't do to 5, 8 corresponding memory read and write operations? Just a pointer addition and subtraction, similar to common variable addition and subtraction ~

Why is equal to zero in the end

Char * * point to address stored inside a char *, char * length is 4 bytes (32-bit), 8 and 5 cannot be stored between a char *, a pointer by subtracting the result is can put how many this kind of data between them
So unable to keep a p1, p2, therefore to 0
If change to char * p1, * (p2);
P1 and p2 is 3

CodePudding user response:

I think because your p, q didn't open up the space of the pointer, behind p=5 (char * *); 8 q=(char * *); These two words are like forced to two Pointers space address
The result of the pointer is presupposed=(address 1-2)/sizeof (type)
As is (8-5)/4=0.75
But due to the default output type int, because 0

CodePudding user response:

Not compiled using GCC, print out; Don't understand,

CodePudding user response:

This is for the

CodePudding user response:

reference sunset 9/f, chardonnay, response:
I think because your p, q didn't open up the space of the pointer, behind p=5 (char * *); 8 q=(char * *); These two words are like forced to two Pointers space address
The result of the pointer is presupposed=(address 1-2)/sizeof (type)
As is (8-5)/4=0.75
But due to the default output type int, because 0

Ok thank you

CodePudding user response:

reference response: 7th floor thousand dream life
Quote: refer to the sixth floor response: thousand dreams life
, that is, a pointer on a computer with int't seemed to be no difference, the only difference is that you specify a pointer, it is so, the computer will listen to you of the value of an int as a address

To describe is: you can think of a pointer is an int [with int the same], but it was you called a pointer, so the computer allows you to (*) ways to bring the int value as the address access to data,

understand thanks

CodePudding user response:

refer to the eighth floor truth is right or wrong response:
Quote: refer to the third floor sunjianan2020418 response:
Quote: reference 1/f, confident boy reply:
will be a problem, is the pointer assignment, 5, 8 address, the building Lord didn't do to 5, 8 corresponding memory read and write operations? Just a pointer addition and subtraction, similar to common variable addition and subtraction ~

Why is equal to zero in the end

Char * * point to address stored inside a char *, char * length is 4 bytes (32-bit), 8 and 5 cannot be stored between a char *, a pointer by subtracting the result is can put how many this kind of data between them
So unable to keep a p1, p2, therefore to 0
If change to char * p1, * (p2);
P1 and p2 is 3

The answer is positive solutions

CodePudding user response:

Pointer to pointer variable type=both poor/pointer points to the length of the

For example, int * a=12; Int * b=6; 12 - a - b=(6)/4.

Here said the int type byte length is 4
  • Related