Giter Club home page Giter Club logo

abstract's Introduction

Abstract

Basic concepts


CHARACTER ARRAY

  • In case of integer array, on printing the array name directly we get the address of array, whereas in case of char array we get the elements of the array unless it finds a NULL. (This is because of operator overloading).

  • In case of character array we don't need to use loop to take input.

  • Reading Sentences:

    • cin doesnot input spaces.
    • use cin.get() [It reads a single character at a time].
    • cin.getline(array,maxlength,delimiter).
  • Palindromic String:

    • Start comparing with the first and last character.
  • Remove consecutive duplicate characters from a string.

  • Find the largest string and it's length.


Memory Allocation in C++

  • Static Allocation
    • Also known as compile time allocation
    • Sizes and locations are fixed during the compile time.
    • Fast but less flexible.
    • Allocation and deallocation is done by compiler itself.
  • Dynamic
    • Also known as run time allocation
    • Allows to define memory size during execution of the program.
    • Uses heap memory. (Dynamic part of the memory).
    • Reusable memory.
    • new is used to allocate the memory, delete is used to free the memory.
    • Allocation and deallocation is done by programmer.

Pointers

&

  • Finds address of variable.
  • Returns address in hexadecimal value.
  • It doesn't work for character variables.
    • It will return the char value instead of address.
    • This is because of operator <<.
    • To get the address we can do explicit typecasting! cout<<(void*)&ch;
  • To store the address of another variable we need to create a pointer variable.
  • It will be of the type datatype* variablename
    • Example: int* y = &x (Declaration with innitialization)
  • Space occupied to store the address of variable will be same irrespective of datatype.
  • '& ' Bucket ---> Address
  • '* ' Address ---> Bucket
  • cout<<* (&x);

Order Complexity Analysis

  • Time complexity (higher preference)
  • Space complexity

abstract's People

Contributors

sanyathisside avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.