int main(void)
{
int a[10] = { 0 };
int var = 10;
int* variable= &var;
printf("Results: &variable=%p, variable=%p, *variable=%p, var=%p\n",
&variable, variable, *variable, var);
printf("Results: a=%p, &a=%p\n", a, &a);
}
In inta[] = {0};
, the address values of a
and &a
were the same as the address values of a[0]
.
So I thought the pointer variable name also pointed to me, but I don't know why the values of &variable
and variable
are different.
int main(void)
{
int a[10] = { 0 };
int var = 10;
int* variable= &var;
printf("variable %x\n", &variable);
printf("variable %x\n", variable);
printf("variable %d\n", *variable);
printf("var %x\n", &var);
printf("var %d\n", var);
}
//Results
Address value of variable c75854a0 //variable
Value stored in variable c75854ac //variable
variable 10 //What is stored in the stored value (address)
Address value of var75854ac //var
Value stored in var 10 //var
variable (0xc75854a0) stores the address of var (0xc75854ac).
Therefore, &variable (address value 0xc75854a0 of variable) and the value entered in variable (0xc75854ac) are different.
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
916 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.