This commit is contained in:
2026-10-13 09:37:59 +03:00
parent 0a72281918
commit 69621ec7ad
5 changed files with 41 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
## task 1
```C
#include <stdio.h>
#include <stdint.h>
void main() {
uint32_t magic = 0xAABBCCDD;
uint8_t*byte_ptr = (uint8_t*) & magic;
printf("Byte 0: 0x%02X\n", byte_ptr[0]);
printf("Byte 1: 0x%02X\n", byte_ptr[1]);
printf("Byte 2: 0x%02X\n", byte_ptr[2]);
printf("Byte 3: 0x%02X\n", byte_ptr[3]);
}
```
## all conclusions
![alt text](<all conclusions-1.png>)
код последовательно читает 4 байта из памяти и выводит каждый из них в шестнадцатеричном формате. Поскльку выводятся они в порядке от младшего адреса к старшему.
## printf output
![alt text](<printf output-1.png>)
программа просто записала число в памяти и затем вывела его байты по порядку, наглядно показывая, что младшие байиы хранятся по младшим адресам.
## memory cell address
![alt text](<memory cell address-1.png>)
код записывавает 4-байтовое число в ячейку памяти,расположенную по адресу rbp - 12.Скорее всего, это инициализация локальной переменной в стеке функции.
Работу выполнил: Юсуфов Алим
гуппа: 228
Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

+12
View File
@@ -0,0 +1,12 @@
#include <stdio.h>
#include <stdint.h>
void main() {
uint32_t magic = 0xAABBCCDD;
uint8_t*byte_ptr = (uint8_t*) & magic;
printf("Byte 0: 0x%02X\n", byte_ptr[0]);
printf("Byte 1: 0x%02X\n", byte_ptr[1]);
printf("Byte 2: 0x%02X\n", byte_ptr[2]);
printf("Byte 3: 0x%02X\n", byte_ptr[3]);
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB