Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created December 8, 2022 04:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velotiotech/b5fa9dc467beecd0eaa3311c21ef9c85 to your computer and use it in GitHub Desktop.
Save velotiotech/b5fa9dc467beecd0eaa3311c21ef9c85 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main (int argc, char *argv[]) {
int i;
int a[3] = {'0','1','2'};
char *ptr = (char *)a;
printf("Setting all a[] elements to 0\n");
for(i=0;i<3;i++) {
ptr[i] = 0;
printf(" a[%d]= %d\n",i,a[i]);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment