I want to know the best practice to write on both C / C++ source codes.
The best practice is to ensure readable. Should left brace be after
function or if on the same line or next line.
For example...
void Test( void) {
int a = 5;
printf( "%d\n", a);
}
or...
void Test( void)
{
int a = 5;
printf( "%d\n", a);
}
It applies to if. For example...
if (a == 5) {
printf( "%d\n", a);
printf( "End...\n";
}
or...
if (a == 5)
{
printf( "%d\n", a);
printf( "End...\n";
}
--
Yours Truly,
Bryan Parkoff
The best practice is to ensure readable. Should left brace be after
function or if on the same line or next line.
For example...
void Test( void) {
int a = 5;
printf( "%d\n", a);
}
or...
void Test( void)
{
int a = 5;
printf( "%d\n", a);
}
It applies to if. For example...
if (a == 5) {
printf( "%d\n", a);
printf( "End...\n";
}
or...
if (a == 5)
{
printf( "%d\n", a);
printf( "End...\n";
}
--
Yours Truly,
Bryan Parkoff
Comment