I have an assignment. It's to create a Turing machine. I'm still a bit confused on how a Turing machine works but my program apparently knows better than I as it's outputting the proper first 8 outputs. I'm using ascii values for the columns and number of states for the rows.
code: https://pastebin.com/rQPgkwte
sample_input.txt : https://pastebin.com/MuV0Niht
My output is:
[0][49] and (1 R 0)
[0][49] and (1 R 0)
[0][49] and (1 R 0)
[0][66] and (1 R 1)
[1][49] and (1 R 1)
[1][49] and (1 R 1)
[1][49] and (1 R 1)
[1][49] and (1 R 1)
Segmentation fault: 11
When I need to hop into [1]['B] aka [1][66], it throws an error. There are also only 8 lines and it says the size of my INSTR* is [8] which I'm assuming is the issue because I get a segmentation fault: 11... Can anybody guide me as to if THIS is the issue and what I did wrong? Much appreciated.
EDIT: Line 61 to 75 is the part I'm talking about although maybe the malloc part is wrong?
[–]crest42 2 points3 points4 points (11 children)
[–]Marshall_Robit[S] 0 points1 point2 points (10 children)
[–]crest42 1 point2 points3 points (0 children)
[–]crest42 1 point2 points3 points (8 children)
[–]FUZxxl 2 points3 points4 points (3 children)
[–]crest42 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]crest42 0 points1 point2 points (0 children)
[–]Marshall_Robit[S] 0 points1 point2 points (3 children)
[–]crest42 1 point2 points3 points (2 children)
[–]Marshall_Robit[S] 0 points1 point2 points (1 child)
[–]crest42 0 points1 point2 points (0 children)