Found 26504 Articles for Server Side Programming

Get and Set the stack size of thread attribute in C

Smita Kapse
Updated on 30-Jul-2019 22:30:25

1K+ Views

To get and set the stack size of thread attribute in C, we use the following thread attributes:pthread_attr_getstacksize()Use for get threads stack size. The stacksize attribute gives the minimum stack size allocated to threads stack. In case of a successful run, then it gives 0 otherwise gives any value.It takes two arguments −pthread_attr_getstacksize(pthread_attr_t *attr, size_t *stacksize)First one for pthread attribute.Second one for giving the size of the thread attribute.pthread_attr_setstacksize()Used for set new threads stack size. The stacksize attribute gives the minimum stack size allocated to threads stack. In case of a successful run, then it gives 0 otherwise it gives ... Read More

C++ Program to Implement Stack Using Two Queues

Aman Kumar
Updated on 16-May-2025 17:12:01

1K+ Views

Queue The queue is a linear data structure that follows the First-In-First-Out (FIFO) operation. Where insertions are done at one end (rear) and deletions are done from another end (front). The first element that is entered is deleted first. Following are the stack operations: EnQueue (int data): Insertion at rear end int DeQueue(): Deletion from front end Stack The stack is also a linear data structure that follows the Last-In-First-Out (LIFO) operation. Where the element will be added and removed from the top. Following are the stack operations: ... Read More

cout << endl vs cout << \\"\\" in C++

Aman Kumar
Updated on 20-May-2025 18:50:02

1K+ Views

In C++, both count

C++ Program to Implement Queue Using Two Stacks

Aman Kumar
Updated on 21-May-2025 14:27:32

2K+ Views

Stack The stack is a linear data structure that follows the Last-In-First-Out (LIFO) operation. Where the element will be added and removed from the top. Following are the stack operations: push (int data): Insertion at top int pop(): Deletion from top Queue The queue is also a linear data structure that follows the First-In-First-Out (FIFO) operation. Where insertions are done at one end (rear) and deletions are done from another end (front). The first element that is entered is deleted first. Following are the stack operations: EnQueue (int data): Insertion at rear end int DeQueue(): Deletion from ... Read More

C++ Program to Implement the String Search Algorithm for Short Text Sizes

Aman Kumar
Updated on 20-May-2025 18:50:55

460 Views

Searching for a substring within a short text is a common operation in many C++ programs, like as small-scale text editors, command line utilities, and education projects. So, in this article, we will implement a string search algorithm for short text sizes. Importance of String Search String search algorithms find a substring within another string. While advanced methods like KMP and Boyer-Moore are great for longer texts, a simple method like Naive search works well for short texts without added complexity. Algorithm to Implement String Search Algorithm for Short Text Sizes The Following is a string search algorithm − Begin ... Read More

C++ Program to Implement Bitap Algorithm for String Matching

Aman Kumar
Updated on 20-May-2025 19:24:35

503 Views

The bitap algorithm is fuzzy string matching algorithm that is used to find approximate matches between a pattern and a text. The algorithm determines whether a given text contains a substring that is "approximately equal" to a given pattern, where approximate equality is defined in terms of Levenshtein distance (or number of edits) if the substring and pattern are within a given distance k of each other, then according to the algorithm they are equal. It begins by precomputing a set of bitmasks containing one bit for each element of the pattern. So we can do most of the work with ... Read More

Octal literals in C

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

5K+ Views

In C/C++ we can use octal literals by typing a zero before the actual number. For example, if an octal number is 25, then we have to write 025.Example Code#include int main() {    int a = 025;    int b = 063;    printf("Decimal of 25(Octal) is %d", a);    printf("Decimal of 63(Octal) is %d", b); }OutputDecimal of 25(Octal) is 21 Decimal of 63(Octal) is 51

Can a C++ virtual functions have default parameters?

Aman Kumar
Updated on 20-May-2025 19:29:14

845 Views

Yes, C++ virtual functions can have default parameters. The default parameter is the value provided during function declaration, such that the value can be automatically assigned if no argument is passed to them. In case any value is passed the default value is overridden and becomes a parameterized argument. Virtual Function A virtual function is a member function declared in a base class and can be overridden in a derived class. When we use a pointer or reference to the base class to refer to an object of the derived class, you can call a virtual function for that object. ... Read More

SQL using C/C++ and SQLite

Nitya Raut
Updated on 30-Jul-2019 22:30:25

2K+ Views

In this section, you will learn how to use SQLite in C/C++ programs.InstallationBefore you start using SQLite in our C/C++ programs, you need to make sure that you have SQLite library set up on the machine. You can check SQLite Installation chapter to understand the installation process.C/C++ Interface APIsFollowing are important C/C++ SQLite interface routines, which can suffice your requirement to work with SQLite database from your C/C++ program. If you are looking for a more sophisticated application, then you can look into SQLite official documentation.Serial NoAPI & Description1sqlite3_open(const char *filename, sqlite3 **ppDb)This routine opens a connection to an SQLite ... Read More

Calling virtual functions inside constructors in C++

Smita Kapse
Updated on 30-Jul-2019 22:30:25

296 Views

Virtual functions calling from a constructor or destructor is dangerous and should be avoided whenever possible as the virtual function we call is called from the Base class and not from the derived class.The reason is that in C++ Super-classes are constructed before derived classes. So, in the following example, as B must be instantiated, before D is instantiated. When B's constructor is called, it's not D yet, so the virtual function table still has the entry for B's copy of s().Example Code Live Demo#include using namespace std; class B {    public: B() {       s();    } ... Read More

Advertisements