QNA > H > How To Solve Errors In Coding

How to solve errors in coding

Debugging is the only key to find out and solve the errors in coding.

Errors can be anything. It can be:-

  1. Syntax errors
  2. Logical errors
  3. semantic errors

Syntax errors is the most common error that we usually do but it is very easy to find out(except few language) and debug.

We usually used to forget “;” at the end of program statement.

  1. int a = 0 // ; is missing 

Logical errors is the most difficult to find out error but we usually think that i himself has developed the logic and coded for it. so there is no chance for logical error and we usually ignore it.

  1. int CalculateRectangleArea( int length, int breadth) 
  2. return length + breadth;  
  3. /* instead of "*" we use "+". */  

semantica si verifica di solito a causa di un uso improprio delle istruzioni del programma.

EX: dobbiamo confrontare due variabili ma invece di usare "==" (operatore relazionale) usiamo "=" (operatore di assegnazione) per errore.

  1. if( a = b ){ } /* qui invece di fare un confronto di uguaglianza il codice sta effettivamente facendo un'assegnazione. */ 

So before solving errors in coding first see the errors carefully and find out whether it occurring due to syntax , logical and semantic errors.

put debug point wherever in code you feel that may be due to this line error is coming.

Enjoy

Di Fremont Giehl

Disney+ sarà disponibile su Roku? :: Come fare gli integrali sulla mia TI-83
Link utili