A
AMT2K5
Hello, I am refreshing my memory on C as I've been in a C++
programming environment for a few months.
Why does the following code produce a heap protection error in Visual
C++ 2005?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[]){
char
*newString = (char *)malloc(sizeof(char));
strcpy(newString, "2005");
printf("%s\n", newString);
free(newString);
return 0;
}
programming environment for a few months.
Why does the following code produce a heap protection error in Visual
C++ 2005?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[]){
char
*newString = (char *)malloc(sizeof(char));
strcpy(newString, "2005");
printf("%s\n", newString);
free(newString);
return 0;
}