fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5. int main(void) {
  6. unsigned char digit[] = {0, 1, 2, 3, 4, 5, 6, 7};
  7. printf("Before:\n");
  8. for (int i = 0 ; i != 8 ; i++) {
  9. printf("%d ", digit[i]);
  10. }
  11. printf("\nAfter:\n");
  12. memset(&digit[4], 0, 4);
  13. for (int i = 0 ; i != 8 ; i++) {
  14. printf("%d ", digit[i]);
  15. }
  16. printf("\n");
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
Before:
0 1 2 3 4 5 6 7 
After:
0 1 2 3 0 0 0 0