Is the Semicolon Used as a Statement Delimiter in C++?

  • Context: C/C++ 
  • Thread starter Thread starter mdnazmulh
  • Start date Start date
  • Tags Tags
    C++
Click For Summary
SUMMARY

The semicolon (;) is definitively used as a statement terminator in C++. It allows multiple statements to be written on a single line, separated by semicolons, although this practice is discouraged for the sake of readability. The discussion emphasizes that while it is technically possible to write numerous statements in one line, maintaining code legibility is crucial for effective programming.

PREREQUISITES
  • Understanding of C++ syntax and structure
  • Familiarity with programming concepts such as statement terminators
  • Knowledge of code readability best practices
  • Basic experience with writing and debugging C++ code
NEXT STEPS
  • Research C++ coding standards for readability
  • Explore the implications of using statement terminators in C++
  • Learn about best practices for writing maintainable C++ code
  • Investigate the impact of code formatting on debugging and collaboration
USEFUL FOR

C++ developers, programming students, and anyone interested in improving code readability and understanding statement terminators in C++.

mdnazmulh
Messages
51
Reaction score
0
Is the semicolon (;) used as statement delimiter in C++?

I have been knowing that semiclon is statement terminator.

Another confusion:
I think, we can write as many as statements we wish in a single line and of course separating them by semicolon. But to ensure program readability we don't do that.
Am I correct?
 
Technology news on Phys.org

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
Replies
81
Views
8K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 40 ·
2
Replies
40
Views
5K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
89
Views
7K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 25 ·
Replies
25
Views
3K