Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to initialize an integer array with memset function and make its output all 1? I hope there is a complete explanation. . .
How to initialize an integer array with memset function and make its output all 1? I hope there is a complete explanation. . .
Functional prototype:

void *memset(void *s,int ch,int n);

Function:

Set each byte of a block in memory to ch, and the block size is n, where n is in bytes.

The title requirement is: initialize an integer array so that its output is all 1.

If you want to output 1, you can use 1 as the character.

int a[5];

memset(a,' 1 ',5 * sizeof(int));