Prepare
Practice
Interview
Aptitude
Reasoning
English
GD
Placement papers
HR
Current affairs
Engineering
MCA
MBA
Online test
Login
Online Practice Test
>
C
« Previous
Next »
How do we delete a dynamically allocated array named `i`?
Options
- delete [0]i;
- delete []i;
- delete i[0];
- free(i);
CORRECT ANSWER : free(i);
Discussion Board
agree with writer
dynamic representation of array is
i = (int *)malloc(arraysize*sizeof(int));
to delete array call
free(i); in c
rahul 11-13-2014 09:33 AM
agreed with the comment
delete i; it will delete memory of first element of the array. To delete whole array we have to do delete []i .
pallavi 09-4-2014 02:59 AM
agreed
yes, definitely. That is a question for C++.
Federico 04-26-2014 01:53 PM
agreed
agree with the comment above
anonymouse 04-2-2014 10:52 PM
Deleting an array
This is a wrong question/answer for C for two reason:
(i) delete keyword is not C it is C++,
(ii) deleting an array in C++ is "delete [] i;"
abbas 11-26-2013 12:02 PM
« Previous
Next »
Write your comments
*
*
Email must be in the form someone@domain.com
*
*
Enter the code shown above:
Please enter the code shown above
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)
Related Content
C test (42)
C (12)
C++ for beginners (10)
C++ (20)
C++ (24)
C++ (18)
C++ (14)
C++ (12)
C++ (15)
C++ (15)
Data structure (20)
Data structure (10)
Data structure (10)
Data structure (10)
PERL (25)
VC++ (11)
Oops (30)
Mainframe (41)
Mainframe (15)
Embedded systems (15)
OOAD (49)
Advertisement
▲