akshatprogrammer / Arrays-Day2

In this repo, we will understand about Arrays and some simple Problem related to it.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Arrays-Day2

In this repo, we will understand about Arrays and some simple Problem related to it.

Whar is Array?

  • Arrays is collection of same types of data/elements.
  • It allows contiguous memory location.
  • Easy access of element by using index.

How to declare an array?

data_type array_name [size];
eg -> int arr[10];

Initialization

Case 1 :

    int arr[] ={1,2,3,4,5};

Case 2:

    int arr[5] = {1,2,3};
 rest of elements will be zero.   

Case 3:

  for(int i=0;i<n;i++)
       cin >> arr[i];
   * Run time.

Dynamic Memory Allocation

  • Size of array can be change during runtime.
  • Free the allocated memory.
  • C defines some library functions under the library stdlib.h

malloc()

used to dynamically allocate single large block of memory.

  • It returns void pointer. diagram

free()

used to deallocate dynamically allocated memory.

  • free(p);

More in this Repository ->

Connect With Me

LinkedIn : https://www.linkedin.com/in/akshat-jain-a24baa18a/
Email : akshat.kodia@gmail.com
Twitter : www.twitter.com/akki_aj89

Personal

Name : Akshat Jain
University : Graphic Era University, Dehradun(UK)

If any problem with this program reach me at Telegram
Here is the link -> https://t.me/akki_aj89

Gratitude

Thank You, if you like it please leave a Star.

About

In this repo, we will understand about Arrays and some simple Problem related to it.

License:GNU General Public License v3.0


Languages

Language:C++ 100.0%