Found 213 Articles for Computer Programming

Difference Between Float and Double

AmitDiwan
Updated on 24-Mar-2021 12:58:50

1K+ Views

In this post, we will understand the difference between float and double data types.floatIt has a single precision.It takes 4 bytes of memory.According to IEEE, it has 32-bit precision.It is used with graphic based libraries.It improves the processing power of programs.It is simple to manage by compilers.Its value can be between 1.2E-38 to 3.4E+38.It can have a precision of up to 6 decimal places.doubleIt has a double precision.It takes 8 bytes of memory.According to IEEE, it has 64-bit precision.Its value can be between 2.3E-308 to 1.7E+308.It can have a precision of up to 15 decimal places.It is considered as the ... Read More

Difference Between int and long

AmitDiwan
Updated on 24-Mar-2021 12:50:50

3K+ Views

In this post, we will understand the difference between ‘int’ and ‘long’ types.intIt is a datatype.It has 32-bits.In terms of bytes, it takes up 4 bytes.In Java, it is between the range –2, 147, 483, 648 to 2, 147, 483, 647.It is also used as a keyword to declare variable of type integer.In comparison to memory required to store ‘long’ variables, it takes up less memory space.longIt is a data type.It takes 64-bits.In terms of bytes, it takes 8 bytes.In Java, its range is between –9, 223, 372, 036, 854, 775, 808 to 9, 223, 372, 036, 854, 775, 807.It ... Read More

Difference between new and malloc( )

AmitDiwan
Updated on 24-Mar-2021 12:48:23

718 Views

In this post, we will understand the difference between ‘new’ and ‘malloc’.newIt is present in C++, Java, and C#.It is an operator that can be used to call the constructor of the object.It can be overloaded.If it fails, an exception is thrown.It doesn’t need the ‘sizeof’ operator.It doesn’t reallocate memory.It can initialize an object when allocating memory for it.The memory allocated by ‘new’ operator can be de-allocated using ‘delete’ operator.It reduces the execution time of the application.Example#include using namespace std; int main(){ int *val = new int(10); cout Read More

Difference Between malloc and calloc

AmitDiwan
Updated on 24-Mar-2021 12:31:57

694 Views

In this post, we will understand the difference between malloc and calloc.MallocThe method ‘malloc’ is used to assign a block of memory when it is requested.It doesn’t clear the memory.It only initializes the allocated memory when explicitly requested.It allocates memory of a specific ‘size’.This size is passed as parameter to it.This size is allocated from a heap.It performs its job quickly.Examplevoid *malloc(size_t size);CallocIt assigns the requested memory to multiple blocks.This memory allocated is initiated to zero.This initialization to 0 is done by ‘calloc’ method.It allocates memory to the required operation of a specific ‘size’, i.e num * size.The ‘num’ refers ... Read More

Difference Between Stack and Queue

AmitDiwan
Updated on 24-Mar-2021 12:28:30

676 Views

In this post, we will understand the difference between Stack and Queue.StackThey are based on LIFO- Last In First Out.This means the element inserted at the end is the first element to get deleted.Insertion and deletion happen in a stack from one end only, i.e the top.Insert operation is known as ‘push’ operation.Delete operation is known as ‘pop’ operation.A pointer is used to access the list, it is known as ‘top’.The ‘top’ points to the last element of the list.It helps work with problems associated with recursion.Representation of Stack (LIFO)QueuesThey are based on FIFO- First In First Out.This means the ... Read More

Difference Between Array and Linked List

Kiran Kumar Panigrahi
Updated on 20-Feb-2023 15:45:40

5K+ Views

The basic difference between an array and a linked list is in their structure. An array relies on the index-based data structure, whereas a liked list is based on the references. Read this article to find out more about Arrays and Linked Lists and how they are different from each other. What is an Array? An array is a consistent set of fixed number of data items. Array stores elements in contiguous memory locations. This means the specific elements can be accessed using easily calculable addresses. Hence, an array provides fast access to find element at a specific index. Another ... Read More

Difference Between Linear Search and Binary Search

AmitDiwan
Updated on 24-Mar-2021 12:26:13

2K+ Views

In this post, we will understand the difference between Linear Search and Binary Search.Linear SearchIt searches through the array/list from the beginning to the end.Every element in the array/list is compared to the element that needs to be searched.It goes till the end of the list.If the element is found, a message is returned, with the index.If the element is not found, relevant message is returned.The elements don't need to be arranged in a specific/sorted order.It can be implemented on any linear data structure like an array, linked list.It is based on sequential approach.It is preferable to use it with ... Read More

Difference Between Applet and Application

AmitDiwan
Updated on 23-Mar-2021 08:42:12

2K+ Views

In this post, we will understand the difference between Applet and Application.ApplicationThey are similar to Java programs.They can be executed independently without using web browser.It requires a ’main’ function for it to be executed.Java applications have full access to local file system and network.They can access all kinds of resources that are available to the system.They can execute the programs with the help of the local system.An application program is required when a task needs to be directly performed for the user.AppletsThey are small Java programs.They have been designed to be included with HTML documents.They need Java enabled web browser ... Read More

Difference Between Link and Association

AmitDiwan
Updated on 23-Mar-2021 08:01:46

6K+ Views

In this post, we will understand the difference between Link and Association.LinkIt can be understood as the physical connection between objects.It helps tell about the relationship among objects.It is represented using line segment between objects.They can’t be referenced.It is used in UML designs.AssociationIt is a specification about the collection of links.The connections are related to classes.It is a general relationship between classes.They are implemented using programming languages as a reference model.It shows connections between classes using line segments.It is used in UML designs.

Difference Between Friend Function and Friend Class

AmitDiwan
Updated on 23-Mar-2021 08:01:22

4K+ Views

In this post, we will understand the difference between Friend function and Friend class.Friend FunctionIt is usually used with operator overloading operation.It is used with the ‘friend’ keyword.It helps give a non-member function the access to the private members of the class.It has to be declared before it is used.It is used to access private and protected members of the class.It can be a global function or a function in another class.Exampleclass Node {    private:    int val;    Node* next;    // Other members of Node Class //    friend int LinkedList::search();    // Only search method ... Read More

Advertisements