Posts

Link of CPP list

 preprocessor :- https://www.tutorialspoint.com/cprogramming/c_preprocessors.htm IPC :- // A complete working C++ program to demonstrate // all insertion methods on Linked List #include <bits/stdc++.h> using namespace std; // A linked list node class Node { public: int data; Node *next; };             // inserts void push(Node** head_ref, int new_data) { Node* new_node = new Node();            /* 1. allocate node */   new_node->data = new_data;            /* 2. put in the data */ new_node->next = (*head_ref);         /* 3. Make next of new node as head */ (*head_ref) = new_node;               /* 4. move the head to point to the new node */ } void insertAfter(Node* prev_node, int new_data)       ///* Given a node prev_node,   insert a new node after the given prev_node...

DataBase

LINK LIST

 

Mutitreading Notes

 https://www.bogotobogo.com/cplusplus/C11/1_C11_creating_thread.php Processes are independent while thread is within a process.   Processes have separate address spaces while threads share their address spaces. Processes communicate each other through inter-process communication. Processes carry considerable state (e.g., ready, running, waiting, or stopped) information, whereas multiple threads within a process share state as well as memory and other resources. Context switching  between threads in the same process is typically faster than context switching between processes. Multithreading  has some advantages over  multiple processes . Threads require less overhead to manage than processes, and intraprocess thread communication is less expensive than interprocess communication. Multiple process  concurrent programs do have one advantage: Each process can execute on a different machine ( distribute program ). Examples of distributed programs are file serve...

segmentztion fault

  // C++ program to demonstrate segmentation // fault when array out of bound is accessed. #include <iostream> using namespace std;   int main() {     int arr[2];     arr[3] = 10;  // Accessing out of bound     return 0; }

Initializer List

  (a) Initializer List When do we use Initializer List in C++? Initializer List is used in initializing the data members of a class.  The list of members to be initialized is indicated with constructor as a comma-separated list followed by a colon.  Following is an example that uses the initializer list to initialize x and y of Point class. -------------------------------------------------------------- #include<iostream>  using namespace std;  class Point {  private:  int x;  int y;  public:  Point(int i = 0, int j = 0):x(i), y(j) {}  /* The above use of Initializer list is optional as the  constructor can also be written as:  Point(int i = 0, int j = 0) {  x = i;  y = j;  }  */ int getX() const {return x;}  int getY() const {return y;}  };  int main() {  Point t1(10, 15);  cout<<"x = "<<t1.getX()<<", ";  cout<...