Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C language about clearing character array and integer array
C language about clearing character array and integer array
C language array and integer array emptying method, examples:

1, integer array is cleared.

Function: void bjero (void * s, int n)

Header file: # include

Function description: set the first n characters of the string S as 0, generally n takes sizeof(s) to empty the whole space;

Example: charstr [10]; bzero(str,sizeof(str)); ? The whole structure can also be cleared;

2, the array is empty

Usage time: 94 seconds

for(k = 0; k & lt 10000 ; k++)

for(I = 0; I & ltMAXi++)

for(j = 0; j & ltMAXj++)

a[I][j]= 0;

Extended data

C language structure initialization

1, definition:

Structure initialization member

{

Int takes precedence;

Two seconds;

Char* third;

Floating four;

};

2. Distribution during definition:

Struct init member test = {-10,3.141590, "Method 1", 0.25};