C++ Learning

So for C++ there are many resources out there… Videos, and Books are what excellent resources, they give you more in depth info(Books even more)… One thing while learning a langauge is to fully dedicate to that language and stay curios. Viedos Resources Include:

Viedos

And Many other viedos(it will clutter if i show all)…

But also you should read many books, for example books about C++ Include:

Before i begin

There is also a highly known stackoverflow post about this:

Begginers

  1. C++ Primer : http://it-ebooks.info/book/1256/

  2. C++ Programming (By C++ Creator Bjane Starstup) : http://mazonka.com/shared/Straustrup4th.pdf

Intermideate

  1. Personally love this book, teaches you more than just programming in C++, but modern techniques and best practices , Modern C++ : http://share.sm3.su/Meyers.Effective.Modern.C++.en.pdf

Advanced

Right now i am not proiefenct in the Advanced category so i can only give you a viedo about Concurency:

Other C++ Examples

  1. I made some of my doodles here :stuck_out_tongue: https://github.com/amanuel2/C-Examples

Tips

Try to understand the actual concept of C++… not just the code, but deeper. Understand what it truely means, rather than just learning the code… make diagrams to illustrate your understanding. coding is halph the job done, understanding the pure concept is the other.

For Example lets truely understand Dynamic Allocation in C++:

#include<iostream>

#define definedVar 4xx2342
/**
  * @param C++E
  * @authr Amanuel Bogale
  */
/*
  Dynamic Memory Allocation.
  Faster way of allocating memory.
  Gets size on the fly, rather than before

  How to dynamically allocate? You use the
  new keyword. When you dynamically allocate
  a variable, you store it in the free space
  called HEAP.
  ________   _________     ________
  |      |   |       |     |      |
  | HEAP |   | STACK |     |STATIC|
  |      |   |       |     |      |
  |______|   |_______|     |______|

  Normally when you use local variables you store them
  in the STACK. When you use global variables you store it
  in The STATIC. But what about HEAP? Well thats where
  The Dynamically Allocated memory gets stored. The diffrent
  thing about the HEAP, is that we have to control it
  by our self, by  allocating memory and also remembering
  to deallocate it so we dont cause Garbage
*/
int main(){

int *p = new int(500);

/*Pointer p is now
pointing to an adress
of an int that is dynamically
allocated*/

delete p;
/*We must dealocate it before setting it to another
variable so the 500 int allocated memory
dosent become garbage
. If you dont do this.. it can lead to memory leak*/

p = new int(700);

delete p;

p = nullptr;
/*Then at last we must
delete the pointer it self
so it dosent become a
dangling pointer... and waste
memory in STACK*/
}

Or Pure Non-Code Diagrams:

# MulThreading vs MultiProccesing

Two Type of Concurent Models..

**Multithreading**

And

**MultiProccesing**

##MultiThreading

To Display:
                   Process 1       Process 2
  MultiThreading:  _________       ___________
                   |       |       |         |
                   |Funcion|       |Function |
                   |       |       |         |
                   |       | _____ |         |
                   |       |       |         |
                   |       |       |         |
                   |_______|       |_________|
                   
  Understanding the diagram:
    Basically as you can see above there are two processes.. That is exactly what MultiThreading is about. And in each process you see 
    there is only one running function. The middle line connecting them both is how the communicate, generaly called
    Interprocess Communication. They can share memory,etc...
    
    
##MultiProcessing
   To Display:
      ___________________________
       |                       |
       |Function 1  Function 2 |
       |    |          |       |
       |    |   _____  |       |
       |    |          |       |
       |    |          |       |
       |    |          |       |
       |________________________
                
     Understanding Diagram:
       Basically as you can see above there is only one process.. well in MultiProccing there is only one process, but MULTIPLE
       Threads. The line in the middle as you can see is thier Shared Memory, where they communicate and so on. But Notice there
       is only one process.
       
       
  #Pros and Cons
    MultiProcessing Pros:
       - Fast To Start
       - Low Overhead
       -Basically Much Better Performance
       
    Multithreading Pros:
      - Much Easier to implement
      - Can Be run on a distributed system
        unlie MultiProcessing

Try to understand the actual concept of C++… not just the code, but deeper. Understand what it truely means, rather than just learning the code…

Beautiful words.

I don’t understand one thing. I hope you can help me.

Dynamic Memory Allocation.
Faster way of allocating memory.
Gets size on the fly, rather than before

Faster than what? Than static allocation of memory? How is that possible? Isn’t calling a memory allocation functions a waste of time if we could use a static allocation?

Dynamic Memory Allocation… I read that from a book or seen from a viedo… but when i look back your actualy right. When i think about it ,it cant be. Also i just did a little bit of research and also found that Stack Allocation is much faster than Heap Allocation. Thats a flaw in my notes… sorry, ill edit. If you guys wanna read more about this issue: