“各元素间无间隔字符”?
程序代码:
#include <stdio.h>
int main( void )
{
int a[] = { 1, 0, 2, 3, 4, 5, 0, 0, 6, 0 };
for( size_t r=0, w=0; w!=10; ++r )
{
if( r >= 10 )
a[w++] = 0;
else if( a[r] != 0 )
a[w++] = a[r];
}
for( size_t i=0; i!=10; ++i )
printf( "%d", a[i] );
}