Created
May 17, 2013 17:43
-
-
Save tivrfoa/5600696 to your computer and use it in GitHub Desktop.
Memset matrix test. memset when using the size of the matrix, change the values in all dimensions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> // for printf | |
#include <cstring> // for memset | |
int main(int argc, char *argv[]) | |
{ | |
int xx[2][2] = {{1,1},{2,2}}; | |
printf("{{%d,%d},{%d,%d}}\n", xx[0][0], xx[0][1], xx[1][0], xx[1][1]); | |
memset(xx, 0, sizeof(xx)); // change to {{0,0},{0,0}} | |
printf("{{%d,%d},{%d,%d}}\n", xx[0][0], xx[0][1], xx[1][0], xx[1][1]); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment