Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Dynamic Array Input and Sum (C99)

Description:

Write a C program that:

  • Asks the user for the number of elements they want to input.
  • Dynamically allocates memory for that many integers using malloc.
  • Accepts input for each integer.
  • Calculates and prints the sum of all entered integers.
  • Finally, frees the allocated memory.

Hints:

  • To access elements of a dynamically allocated array of integers, you can use pointer arithmetic or array indexing.
  • Always ensure that dynamically allocated memory is freed using free() to prevent memory leaks.

Expected Outcome:

After entering a specific number of integers, the program should display their sum.