If we want to write to write a C code, to check if halting problem halts on a given input, how it will be ? I tried this code as shown below but stuck

int main(int argc, char * argv[])


if(argc < 2){ printf("Please input an executable and its input enclosed in double quotes\n"); exit(0);}

//and here argv[1] has the exe path and the input w. }

Is any better code possible? Please then explain it too

  • 1
    $\begingroup$ I'm having serious trouble understanding what you are trying to ask. What do you mean by "halting problem halts on a given input"? A problem doesn't halt on input; a machine or program does. $\endgroup$ – Yuval Filmus Oct 12 '18 at 3:40
  • $\begingroup$ We are not homework cheating service. What are your thoughts? What do you expect to gain from answer? Where is the code executing input? If you expect to get working C code then your question is off-topic here. $\endgroup$ – Evil Oct 12 '18 at 3:41
  • $\begingroup$ I know halting problem undecidable.But that is how Alan turing thought there must be some macine, which works like modern computer, So, the connection of computer with halting problem, that I want to know in a code format. $\endgroup$ – Srestha Oct 12 '18 at 4:28
  • $\begingroup$ I was reading about enigma code and then alan turing paper about "a machine which can thought" like articles. Now, why halting problem comes in "machine can thought" in this assumption? How it helped in modern computer designing? $\endgroup$ – Srestha Oct 12 '18 at 4:55
  • $\begingroup$ Alan Turing did a lot of different things. The Enigma machine was not a "computer", in most senses of the word. And the Halting Problem was not needed (or necessarily even useful) in the designing of modern computers. Given that the halting problem is undecidable, it's unreasonable to try to write a program to do it. $\endgroup$ – Alex Meiburg Oct 12 '18 at 9:06

Coding questions are off-topic, here. However, the entire significance of the halting problem is that it is undecidable. That means that it is provably impossible to write any program that solves it. The reason you got stuck is that you're trying to do something that is literally impossible: not so difficult that you can't do it, but actually impossible. So, arguably, this isn't a coding question because there is no code that can do what you want.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.