MENU

Fun & Interesting

Learn C memory addresses in 7 minutes 📬

Bro Code 85,235 lượt xem 3 years ago
Video Not Working? Fix It Now

C memory address tutorial example explained

#C #memory #address

int main()
{
// memory = an array of bytes within RAM (street)
// memory block = a single unit (byte) within memory (house), used to hold some value (person)
// memory address = the address of where a memory block is located (house address)

char a;
char b[1];

printf("%d bytes\n", sizeof(a));
printf("%d bytes\n", sizeof(b));

printf("%p\n", &a);
printf("%p\n", &b);

return 0;
}

Comment