Posts

Pointers In arrays||Dynamic Allocation||Dynamic allocation of objects||Dynamic Allocation of variables||Dynamically Allocated Arrays

Image
  πŸ‘‰  POINTERS IN ARRAYS  πŸ‘ˆ -by Aaditya Nayak Introduction: As we all know pointer is a variable that points towards an address of a entity. And you must have also seen the syntax to define a pointer variable pointing a single entity(variable or an object), which is : data_type * pointer_name = variable_or_object_name; Now in this blog we will see how to define a pointer pointing a group of elements or an array. Syntax And Application: Syntax: data_type * pointer_name = array_name;  (here, you don’t need to add &) Explaination: We don’t add & here because in an array say: arr – arr represents pointer towards first element which is arr[0] in arr. Now, since arrays are contiguous blocks in memory lets consider a condition: Condition:  (arr is an integer array containing n+1 elements) If first element arr[0] is present at an address x and size of integer in your system is 4bit so the next element will be present at address x+4 and so on, therefore nth elem...

Reference and Pointers in C++

Image
  by - Yash Ukalkar |  Introduction -  Pointers and reference variables are often used when one needs to write programs that control and manage the memory available in the machine. Pointers work close to memory and allow us to implement data storage and processing in an efficient manner. For example, a linked list is a data structure that uses pointers and allows us to store and delete data, in a sequential manner, but faster than many other methods.

Flow of Control in C++ || if-else-else if in C++ || Learn about while, do-while, for and for-each (range based for) loops || Return statements || break and continue

Image
  Control flow or Flow of Control in C++ by - Yashvardhan Singh As you it was already discussed in previous blogs, C++ offers many statements to execute only a selected block of code, instead of blindly executing from top to bottom, today we are going to elaborate upon such statements. The Control Flow statements can be divided under the following categories: Decision making statements Looping statements Branching statements (Jump statements and return) Others (async, coroutines, exceptions, etc.,) ...to be discussed later Now let us discuss about the same:- Decision making statements:- If-else : These C++ statements help you to make a decision, any command based upon 'if then' or 'if then else'  logic can be written using if else statements. Example: #include   <iostream> int   main () {      bool   hungry  =  true ;      if  ( hungry )     {       ...

What Is Functions In C++ ? || Explained By Examples || Function Types

Image
  πŸ‘‰ WHAT IS FUNCTION πŸ‘ˆ By - Dhruv Arne   Function – Function is a block of a code that is executed only when it is called in the code. In C++ if you want to make a function then the syntax is   Return_type   function_name ( parameter_datatype   parameters ( if  it have)) { Code Return  something; }   Here return type is the type of data which function is going to be returned. It is not mandatory that the function should have return something always, it is optional. But now you have a question in your mind that if we don’t return something then what we will write in the place of return_type when declaring a function?. I will tell you the answer you have to write void which means nothing. Void is a datatype in c++ that means nothing, so there is no example of a void data type because void means nothing. Now here in the syntax, I wrote a word parameter, so what does parameter mean?. Basically, parameters are a need of that functio...

Basics Of recursion||recursion||recursion in C++||recursion explained||checking prime numbers using recursion||factorial using recursion||fibonacci series using recursion||GCD using recursion||LCM using recursion||Star pyramid pattern||Star pattern using recursion||String concatenation in C++||Advantages of recursion||Disadvantages of recursion||

Image
πŸ‘‰  Basics Of Recursion  πŸ‘ˆ                     - by Aaditya Nayak In this blog I am going to explain about basics of recursion. I will be covering meaning of recursion, some basic programs using recursion, advantages of recursion. This blog will be very useful for beginners since recursion is a topic that is considered to be confusing and tricky at the beginners stage and for experienced its always good to brush up your concepts. What is Recursion? Recursion is defined as repeated application of procedure or definition. In programming, as you know that functions are the set of instructions which can be defined once and can be called anywhere needed.  While the recursion is the condition when a function calls itself inside the its own function definition. In short you can remember that, in function definition if we are returning a function call of that function itself, this condition is known as recursion. Or you can say w...