C language variable assignment

for example, the following code:

-sharpinclude <stdio.h>
int main()
{
    int a, b;
    a = 10;
    b = a;
}

it is said on the Internet that b = a copies the data in the memory space of the a variable to the memory space of the b variable, is that so?
is it possible that the data of an and b are exactly the same and take up two pieces of memory space? Doesn"t
say that copy, an and b share the same memory address when writing?
I just learned C, but I don"t quite understand. Thank you

.
Apr.03,2021

main.c
-sharpinclude <stdio.h>
int main()
{
    int a, b;
    a = 10;
    b = a;
    printf( "addr: 0x%08x\n", &a);
    printf( "addr: 0x%08x\n", &b);
    printf( "size: %zd\n", sizeof(a));

}
[xxx@xxx]-sharp ./a.out
addr: 0x68a28bcc
addr: 0x68a28bc8
size: 4

the difference between the two addresses is four bytes, obviously not at the same address


because C is a statically typed language, two different variables are located in two different memory addresses, even if the contents are exactly the same. Please note that it is a "variable"!

Menu