Revathi Satya Kondra

Revathi Satya Kondra

Technical Content Writer, Tutorialspoint

65 Articles Published

Articles by Revathi Satya Kondra

Page 3 of 7

C Program to find size of a File

Revathi Satya Kondra
Revathi Satya Kondra
Updated on 07-May-2025 3K+ Views

The size of a file refers to the number of bytes it occupies in memory. In C, size of a file can be found by moving the file pointer to the end of the file and checking its position. The position indicates the number of bytes the file contains. The most common way to do this is by using two functions: fseek() (to move to the end) and ftell() (to get the current position, which is the size of the file). Syntax Following is the syntax is as follows: FILE *fp = fopen("file.txt", "rb"); fseek(fp, 0, SEEK_END); long size = ...

Read More

Print “Hello World” with empty or blank main in C++

Revathi Satya Kondra
Revathi Satya Kondra
Updated on 07-May-2025 720 Views

In this problem, we will see how to print "Hello World" into the console, but we cannot write anything into the main function. This problem can be solved in different ways. Initially, we will create a global variable, then we will store the returned value of the printf() function into that variable. When printf() is executed, then it will be printed. You can print "Hello World" without using the logic inside the main() function in different ways, such as using Global Constructors, Class Object and macros, or preprocessor, etc. Using Global Constructor A global constructor is the constructor of a global object ...

Read More

How to declare a pointer to a function in C?

Revathi Satya Kondra
Revathi Satya Kondra
Updated on 06-May-2025 6K+ Views

In C, a pointer is a variable whose value is the address of another variable or memory block, i.e direct address of the memory location. Like any variable or constant, you must declare a pointer before using it to store any variable or block address. Basic Pointer to a Function A pointer to a function is simply a variable that stores the address of a function instead of a normal data value. Syntax Following is the syntax of basic pointer to a function: Datatype *variable_name Algorithm Following is the algorithm for the basic pointer to a Function: Begin. ...

Read More

Zombie and Orphan Processes in Linux

Revathi Satya Kondra
Revathi Satya Kondra
Updated on 06-May-2025 9K+ Views

Every program runs as a process in Linux operating system. When a process ends or gets disconnected from its parent, special types of processes can be created. These processes are known as zombie and orphan processes. Details about the zombie and orphan processes are given as follows: Zombie Processes A zombie process is a process whose execution is completed but it still has an entry in the process table. Zombie processes usually occur for child processes, as the parent process still needs to read its child's exit status. Once this is done using the wait system call, the zombie process ...

Read More

How to append a vector in a vector in C++?

Revathi Satya Kondra
Revathi Satya Kondra
Updated on 02-May-2025 16K+ Views

In C++, a vector is like a array which can be used accordingly. If you want to combine (append) two vectors, you need to add all the elements of one vector to the end of another. This is called appending a vector in a vector. To append a vector in a vector can simply be done by vector insert() method and moreover by using loops and std::move() to transfer elements. There are different ways to append one vector into another in C++. The most common ones are: Using insert() method Using ...

Read More

How does a vector work in C++?

Revathi Satya Kondra
Revathi Satya Kondra
Updated on 30-Apr-2025 491 Views

In C++, a vector is a dynamic array that can grow or shrink automatically. It can store elements in a row (contiguous memory) and resizes itself when needed. When it runs out of space, it creates a bigger array, copies the old data, and adds the new one. So, you can easily add, remove, or access elements using functions like push_back(), size(), and erase(). Basic Operations (push_back, access) A vector stores elements in a contiguous memory block. You can add elements using push_back() and access them using [] or at(). Syntax Following is the syntax is as follows: vector vec; ...

Read More

Can namespaces be nested in C++?

Revathi Satya Kondra
Revathi Satya Kondra
Updated on 21-Apr-2025 410 Views

Yes, the namespace can be nested in C++. We can define one namespace inside another namespace. This makes it easier for developers to design a more structured and hierarchical format for their code. Syntax The following is the syntax as below : namespace namespace_name1 { // code declarations namespace namespace_name2 { // code declarations } } You can access members of a nested namespace by using resolution operators as follows: // to access members of namespace_name2 ...

Read More

Pointers vs References in C++

Revathi Satya Kondra
Revathi Satya Kondra
Updated on 21-Apr-2025 10K+ Views

In C++, both pointers and references are used to access and manipulate memory. But they behave differently. This guide explains each with simple words and examples. We understand the topic by learning how each is declared, used, and what differences exist between them. What are C++ Pointers? The pointers are used to store the address of a variable. We can change what they pointing to, and also can assign NULL to them. A pointer is similar to a signpost that contains the memory address of another variable, and you can directly access or change the variable by its address. Syntax ...

Read More

Strand sort in C++

Revathi Satya Kondra
Revathi Satya Kondra
Updated on 21-Apr-2025 505 Views

In C++, the strand sort is a recursive sorting algorithm. It is used to extract increasing subsequences repeatedly (called strands) from the input list and merge them into a sorted list. There are multiple libraries that can be used for different purposes. This sorting is one of them. This sorting technique is particularly good for sorting linked lists, but can be used with arrays too. The following is a list of approaches for strand sorting in C++: These approaches is to extract sorted strands (in increasing/descending order) from the unsorted list and merge them one by one into a final ...

Read More

Execute both if and else statements in C/C++ simultaneously

Revathi Satya Kondra
Revathi Satya Kondra
Updated on 17-Apr-2025 562 Views

In this article, we will see how to execute the if and else section simultaneously in a C or C++, code. This solution is a little bit tricky. When the if and else are executed one after another then it is like executing statements where if-else are not present. But here we will see if they are present how to execute them one after another. Let's go through the different ways to simulate execution of both if and else blocks. This may include using functions, macros, or separating logic completely. Using Separate Functions ...

Read More
Showing 21–30 of 65 articles
« Prev 1 2 3 4 5 7 Next »
Advertisements