Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我怎么写';世界你好';在C语言中不使用任何函数?_C_Assembly - Fatal编程技术网

我怎么写';世界你好';在C语言中不使用任何函数?

我怎么写';世界你好';在C语言中不使用任何函数?,c,assembly,C,Assembly,我在quora上找到了做这件事的方法,但我无法理解 You can achieve this using opcodes..... const int main[] = { -443987883, 440, 113408, -1922629632, 4149, 899584, 84869120, 15544, 266023168, 1818576901, 1461743468, 1684828783, -1017312735}; Now follow below steps.... S

我在quora上找到了做这件事的方法,但我无法理解

You can achieve this using opcodes.....

const int main[] = {  -443987883, 440, 113408, -1922629632,  4149, 899584, 84869120, 15544,  266023168, 1818576901, 1461743468, 1684828783,  -1017312735};
Now follow below steps....
Save that in hello.c
then gcc -o hello hello.c
then ./hello
Hola..... Hello World!
Op代码将针对特定硬件和基于it架构的控制器而特定。如果我理解正确,那么对于不同的硬件和平台,操作代码将是不同的。所以这不是一个通用的解决方案。但是我试着在IDEone上编译它&它给出了运行时错误。有没有通用的解决方案


在C语言中,
main
函数是程序的入口点。在程序二进制文件中,编译函数的机器代码将被放入二进制文件的
.text
部分以及
函数在符号表中的位置


在上面的代码中,我们使用相同的
main
symbol名称创建一个常量数组。由于数组是常量,因此它也将被放置在二进制文件的
.text
部分。由于
.text
部分中的任何代码都是可执行的,因此没有任何东西可以阻止主数组中的操作码执行。

请,也没有代码。在那里试试看。:)反汇编二进制代码,你会发现,这段代码首先不是一个有效的C程序。它可能在某些平台上工作,但不是所有平台。Quora上生长的东西应该留在Quora上。答案已经解释了。