Skip to main content

Posts

Showing posts from October, 2020

Vectors in C++-Important topics in C++-Computer science

  Vectors in C++ ->Watch this for FUN -  Funny job interview Are you getting bored with online lectures? ->Watch this -  When online lectures are boring   Vectors in C++ are a sequence container class that implements the dynamic size of the array to store things without caring for its size. ****** Array vs Vectors An array although is a static allocation where size is fixed, but in Vectors, the size is not fixed due to its dynamic nature.  ***** Declaration of Vectors std:: vector<int> vec; //under #include<vector> library ***** Important functions of vectors are: emplace() ->vec.emplace(position,value) inserts the value at the specified position. emplace_back() ->vec.emplace_back(value) inserts the value at the end of the vector. insert() ->vec.insert(position,value) inserts the value at the front of the position given in the function. resize() ->vec.resize(value), resizes the vector's size to the value. reserve() ->vec.reserve(...

What are Macros in C? Macros/preprocessor directives-Important topic in C programming language-computer science/Information technology

M acros are preprocessor directives in C, a very important topic in C, are used at the top of the C program. It is nothing but a constant value that you have to declare at the starting of the program. ->Watch this for FUN -  Funny job interview Are you getting bored with online lectures? ->Watch this -  When online lectures are boring   For example, #define P 11.20 Here if you use P in any part of the program then it is nothing but 11.20. It should be define on the top, #include<stdio.h> #define P 11.20 int main() {     //code } There are some major pre-defined macros which you can use in the program. _ _ DATE _ _ For the current date. _ _ TIME _ _ For the current time.  _ _ FILE _ _ For getting the current file name. _ _ LINE _ _ For getting the current line number. And even you can define the function in macros as, #define ADD(a,b) a+b where just use ADD(a,b), it will return a+b in the value.  Are you getting bored with online lectures? W...

Translate