A Program that does nothing

Write a program in C that does nothing not even takes memory?

Questions by d.gupta03

Showing Answers 1 - 22 of 22 Answers

you can't design a program which doesn't take memory. even if you write

#include<stdio.h>
void main()
{
}

it will take some memory in stack for main functions. as main is a functions being called by startup code, so when ever u call a  function some information is stored in stack such as base pointer, startup code address etc.

so no program is there which doesn,t take memory.

  Was this answer useful?  Yes

kbjarnason

  • Jul 1st, 2010
 

I suspect it is impossible to write a C program which "takes no memory", unless one rewrites the startup code for the implementation.

For example, argv[0] is the "program name", which is almost certain to be recorded by the startup code, even if the value is not subsequently used, and thus the program will require _at least_ the memory for the name.  Even if the name were an empty string, storage would be set aside for the argv pointer array.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions