is memset more efficient than for loop. so if i have
char x[500];
memset(x,0,sizeof(x));
or
char x[500];
for(int i = 0 ; i &
Good compilers will recognize the for loop and replace it with either an optimal inline sequence or a call to memset. They will also replace memset with an optimal inline sequence when the buffer size is small.
In practice, with an optimizing compiler the generated code (and therefore performance) will be identical.