Delete Array
Submissions: 3429   Accuracy:

83.42%

  Difficulty: Easy   Marks: 2
Associated Course(s):   Fork CPP   Placement 100

Here, we'll learn the delete keyword that's used to clear the dynamically allocated memory in CPP.

Given a dynamic array A of size N. The task is to find the sum of array elements.

Input Format:
First line of input contains number of testcases T. For each testcase, there will two line of input, first of which contains N, size of array. Next line contains N integers.

Outpu Formatt
For each testcase, output the sum of array elements and in next line prints the first array element(A[0]).

Your Task:
Just comment the line that is deallocating the array.

Constraints:
1 <= T <= 10
1 <= N <= 100
1 <= A[i] <= 105

Example:
Input:

1
5
1 2 3 4 5

Output:
15
1

Explanation:
Testcase 1:
Sum of array elements is 15 (1 + 2 + 3 + 4 + 5). The first element is 1.

** For More Input/Output Examples Use 'Expected Output' option **

Author: Dhiman Mayank


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.