What is circular reference?
A circular reference in computer programming is a situation where two values refer to each other. This type of reference can be extremely problematic when two functions or values are dependent on each other to define. This term is used in the IT world as it is used in general language when one thing refers to another and vice versa.
An example of a circular reference in programming is a Microsoft Excel spreadsheet. Excel involves adding to or working with different cells with functions that target specific ranges of cells. In some cases, two different entries in Microsoft Excel for the calculation can be dependent on each other and create a circular reference. This can lead to a deadlock situation that makes calculations impossible. To minimize this type of situation, Microsoft added a circular reference function to the application toolbar. This helps users identify and remove circular references.
Circular reference is also problematic in programming and can occur when one function returns a given result that is used by another function to return the same result. In some cases, this simply yields useless code. Other situations can deadlock or crash a program.