Agreed: ability != style
Better than what? I'd say that that is not better than:
Code:
int number;
printf( "enter a number: " );
scanf( "%d", &number );
Since the printf is related to the scanf and it is unlikely that code that might access number would be inserted in between, so the declaration just before the printf is still sufficiently near first use. However, it is better than:
Code:
int number;
/* ... several lines of code that does not involve number ... */
printf( "enter a number: " );
scanf( "%d", &number );