Can you pls send me a sample code for delete array in C language.delete key word is not in C language.Isn't it?
delete array
Collapse
X
-
Yes, You are right. Delete is a keyword for the same purpose in C++. malloc and free are the functions in C to allocate and deallocate memory respectively. You can use something like thisOriginally posted by 19831030Can you pls send me a sample code for delete array in C language.delete key word is not in C language.Isn't it?
RegardsCode:int* ip; ip = (int*)malloc(sizeof(int) * 100); ... free((void*)ip);
-
just to add..Originally posted by zodilla58Yes, You are right. Delete is a keyword for the same purpose in C++. malloc and free are the functions in C to allocate and deallocate memory respectively. You can use something like this
RegardsCode:int* ip; ip = (int*)malloc(sizeof(int) * 100); ... free((void*)ip);
u can't delete an array until or unless its dynamically allocated using malloc/calloc..Comment
Comment