小编Alc*_*isz的帖子

当我有物理地址时,如何获取段内存地址?

存储单元的物理地址以 1A32H 的形式给出。内存段的起始地址是什么。或者更准确地说,我应该用来访问它的 seg:off 地址。

有人可以逐步解释我如何解决这个问题吗?

assembly real-mode memory-segmentation x86-16

1
推荐指数
1
解决办法
413
查看次数

为什么我的字符串长度与我选择的不同?

我想用数字创建一个字符串。所以我将字符串数组的长度定义为 10,但是当我在控制台中启动程序时是 11 个字符。

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define N 10

using namespace std;

int main()
{
    srand(time(0));
    int numArr[N];

    for(int i = 0; i < N; i++)
        numArr[i] = rand() % 26 + 97;

    for(int i = 0; i < N; i++)
        std::cout << numArr[i] << " ";
    std::cout << std::endl;

    char str[N] = "";

    for(int i = 0; i < N; i++)
        str[i] = numArr[i];

    std::cout << str << endl;
    std::cout << strlen(str);
    return …
Run Code Online (Sandbox Code Playgroud)

c++

0
推荐指数
1
解决办法
74
查看次数

标签 统计

assembly ×1

c++ ×1

memory-segmentation ×1

real-mode ×1

x86-16 ×1