Does it have some memory leak?
-
char chr[100]; strcpy( chr, "oh,my god,give u a long word" ); chr[5] = '\0'; Joise is a C++ fun!
No - the array has been allocated on the stack, so there is no need to delete it (in fact deleting it is an error). Dave http://www.cloudsofheaven.org
-
char chr[100]; strcpy( chr, "oh,my god,give u a long word" ); chr[5] = '\0'; Joise is a C++ fun!
No it is not possible to have a leak, char[100] allocate memory on the stack, when you exit function memory will be simply popped. In fact if you had allocated memory with: a = malloc(100); a[1] = NULL; free(a); you would not be leaking, de-allocator knows what size you allocated.
-
No - the array has been allocated on the stack, so there is no need to delete it (in fact deleting it is an error). Dave http://www.cloudsofheaven.org
-
No it is not possible to have a leak, char[100] allocate memory on the stack, when you exit function memory will be simply popped. In fact if you had allocated memory with: a = malloc(100); a[1] = NULL; free(a); you would not be leaking, de-allocator knows what size you allocated.