closed by
760 views
1 votes
1 votes
closed as a duplicate of: Program Flow Graph

someone please share detailed rules for this along with solution- would be of great help.

and we usually dont take start and end state- arent they extra here? coz count comes different

 

closed by

1 Answer

3 votes
3 votes

In order to form control flow graph we must form basic blocks of instructions and assign edges in between them to show the flow of program as per condition met.Some rules to form basic blocks:

1.start and end blocks are added to show beginning and ending of data flow .

2. first statement is always a beginning of new block.

3. goto expression(conditional/ unconditional branching) pointing to any statement, form a new basic block starting with respective target statement no.

4. statement that follows immediately a conditional/ unconditional expression reflects beginning of new block.

The solutions must have 8 ans as per these rules. Please find below image for solution:

 

Related questions

2 votes
2 votes
1 answer
2
rahul sharma 5 asked Jan 24, 2018
1,254 views
Consider the intermediate code given below:The number of nodes and edges in the control-flow graph constructed for the above code, respectively are X and Y. The value of ...