C
cpptutor2000
I am compiling and running the following code snippet on a Linux box -
I am really
puzzled by the answers. Could someone please tell me what might be
wrong?
void test(){
int m = 0;
int n = 0;
int i = 0;
int j = 0;
double start = 0.0;
double end = 0.0;
double gap = 0.0;
struct timeval tp;
aes_context ctx;
unsigned char buf[16];
unsigned char key[32];
for(i = 0; i < 16; i++){ buf = 'a'; }
for(j = 0; j < 32; j++){ key[j] = '9'; }
printf("%d, %d\n", strlen(buf), strlen(key));
/* Some more code omitted */
}
The print statements provide the answers 16, 48
Could someone please provide some hint as to what might be the problem?
I am really
puzzled by the answers. Could someone please tell me what might be
wrong?
void test(){
int m = 0;
int n = 0;
int i = 0;
int j = 0;
double start = 0.0;
double end = 0.0;
double gap = 0.0;
struct timeval tp;
aes_context ctx;
unsigned char buf[16];
unsigned char key[32];
for(i = 0; i < 16; i++){ buf = 'a'; }
for(j = 0; j < 32; j++){ key[j] = '9'; }
printf("%d, %d\n", strlen(buf), strlen(key));
/* Some more code omitted */
}
The print statements provide the answers 16, 48
Could someone please provide some hint as to what might be the problem?