This topic has been archived. It cannot be replied.
-
工作学习 / IT技术讨论 / 请问用C如何动态分配一个数组,其内存首地址由参数制定。我是象汇编那样用指针直接访问内存。有相关的函数可以调用么? malloc, calloc 好象不能指定地址。
-rock_jack(Rock Jack);
2001-4-13
(#45388@0)
-
为什么要这样?这在保护模式下是很危险的。如果要共享数据,可以
使用共享内存的方式。
-dragonman(阿龙);
2001-4-14
(#45442@0)
-
是一个嵌入软件,软件方面在RAM指定地址分配一个数组,同硬件共享。我是用汇编写的,现在我想知道用C是否有相关的函数可以按指定地址分配数组。
-rock_jack(Rock Jack);
2001-4-14
(#45586@0)
-
在95上可以直接写内存地址呀。直接用输出语句就行了。在31下困难些,要计算地址偏移,想来你也不需要写31下的程序。
-liding_wang(无坚不摧大砍刀);
2001-4-15
(#46351@0)
-
I don't get you, it might be better if you describe it in English.
I go nuts when people start to talk about programming in chinese terminologies.
-lumlumq(lumlum);
2001-4-14
(#45501@0)
-
sorry, next time i'll do it in english.
-rock_jack(Rock Jack);
2001-4-14
(#45590@0)
-
The answer is machine (CPU type) and operating system relatedThe answer is machine (CPU type) and operating system related. For DOS (of course Intel CPU), you can directly assign the absolute address of the block of memory to the memory pointer. For a near pointer, just offset need to be assigned. For a far pointer, both offset and segment. However you should code to protect the block of memory allocated in this way.
-old(HH);
2001-4-15
{359}
(#46076@0)
-
Hi, so long no see. How r u? You r a really high hand.
-diao_david(LoveBeer);
2001-4-15
(#46077@0)
-
Not so bad. I just have a little bit of obsolet skill which is useless here.
-old(HH);
2001-4-15
(#46091@0)
-
yes,this is what i'm doing... thanks!
-rock_jack(Rock Jack);
2001-4-15
(#46126@0)
-
Thanks guys, I just wonder whether there is a function i can call to do that. I must make sure before i told others that we can't do it with something like malloc, calloc... and the only way is using pointer.
-rock_jack(Rock Jack);
2001-4-15
(#46388@0)
-
You can not find a standard function nowaday, I think.
-old(HH);
2001-4-15
(#46412@0)