
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1339 Articles for C

4K+ Views
In this section we will see what is the fork system call in C. This fork system call is used to create a new process. This newly created process is known as child process. The current process which is creating another child process is called the parent process.A child process uses the same program counter, CPU register, same files that are used by the parent process.The fork() does not take any parameter, it returns integer values. It may return three types of integer values.Negative Number: It returns negative number when child process creation is failedZero Value: It returns Zero for ... Read More

473 Views
What is an Assertions in C/C++? An assertion is a statement used to test assumptions made by the program. When an assertion fails, the program displays an error and stops. This is mainly used for debugging. In C and C++, assertions are handled using the assert() macro defined in the (C) or (C++) header file. Following is the declaration for assert() Macro. #include // in C // or #include in C++ assert(expression); The parameter of this assert() is expression: This can be a variable or any C/C++ expression. If ... Read More

22K+ Views
Multithreading is a specialized form of multitasking and a multitasking is the feature that allows your computer to run two or more programs concurrently. In general, there are two types of multitasking: process-based and thread-based.Process-based multitasking handles the concurrent execution of programs. Thread-based multitasking deals with the concurrent execution of pieces of the same program.A multithreaded program contains two or more parts that can run concurrently. Each part of such a program is called a thread, and each thread defines a separate path of execution.C does not contain any built-in support for multithreaded applications. Instead, it relies entirely upon the ... Read More

1K+ Views
In C/C++, we use the header files for accessing functions such as int, char, string, etc. The printf() function of C is also a built-in function that is declared in the "stdio.h" header file and it is used to print any kind of data on the console. C to Print "Hello World" without Header Files The Hello World is the given string that is used in the printf() to get the output. Make sure you don't have any headers to print the result. So, use an argument like (const char *text, ...) that solves the problem. Syntax Below is the ... Read More

223 Views
In this section we will see how to execute the if and else section simultaneously in a C or C++ code. This solution is 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.Example Code#include using namespace std; int main() { int x = 10; if(x > 5) { lebel_1: cout

2K+ Views
In this section we will see how to convert an integer number to a string.The logic is very simple. Here we will use the sprintf() function. This function is used to print some value or line into a string, but not in the console. This is the only difference between printf() and sprintf(). Here the first argument is the string buffer. where we want to save our data.Input: User will put some numeric value say 42Output: This program will return the string equivalent result of that number like “42”Algorithm:Step 1: Take a number as argument Step 2: Create an empty ... Read More

1K+ Views
A switch statement allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each switch case.The syntax for a switch statement in C programming language is as follows −switch(expression) { case constant-expression : statement(s); break; /* optional */ case constant-expression : statement(s); break; /* optional */ /* you can have any number of case statements */ default : /* Optional */ ... Read More

6K+ Views
Heap OverflowHeap is used to store dynamic variables. It is a region of process’s memory. malloc(), calloc(), resize() all these inbuilt functions are generally used to store dynamic variables.Heap overflow occurs when −A) If we allocate dynamic large number of variables −int main() { float *ptr = (int *)malloc(sizeof(float)*1000000.0)); }B) If we continuously allocate memory and do not free after using it.int main() { for (int i=0; i

324 Views
In this article we will see how to add two numbers without using arithmetic operators like +, ++, -, or --.To solve this problem, we can solve them using binary adder logic. In that case we were designed half adder and full adder. These adders can add one bit binary numbers. By cascading multiple adders, we have can create circuit to add bigger numbers.In that adder, we have performed XOR operation among the numbers, then for the carry we were performing the ANDing logic. These features are implemented here to add two numbers.Example Code Live Demo#include using namespace std; int ... Read More

22K+ Views
Dereferencing is used to access or manipulate data contained in memory location pointed to by a pointer. *(asterisk) is used with pointer variable when dereferencing the pointer variable, it refers to variable being pointed, so this is called dereferencing of pointers. int main() { int a = 7, b ; int *p; // Un-initialized Pointer p = &a; // Stores address of a in ptr b = *p; // Put Value at ptr in b }Here, address in p is basically address of a variable.Complete tutorial on dereferencing: C++ Dereferencing