Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Enumerate over an enum in C++

Anvi Jain
Answered 14h 48m ago

Enumeration is a user defined datatype in C/C++ language. It is used to assign names to the integral constants which makes a program easy to read and maintain. The keyword “enum” is used to declare an enumeration.The following is the syntax of enums.enum enum_name{const1, const2, ....... };Here, enum_name − Any ... Read More

What is difference between GCC and G++ Compilers?

Nishtha Thakur
Answered 14h 50m ago

We use gcc and g++ compilers in different times. Here we will see what are the differences between gcc and g++.The gcc is GNU C compiler, and g++ is GNU C++ compiler. The main differences are like below −gcc can compile *.c or *.cpp files as C and C++ respectivelyg++ ... Read More

Compiling a C++ program with GCC

Anvi Jain
Answered 14h 52m ago

Here we will see how to compile C++ program using GCC (GNU C Compiler). Let us consider, we want to compile this program.Example#include<iostream> using namespace std; main() {    cout << "Hello World. This is C++ program" << endl; }If this is a C program, we can compile with GCC ... Read More

How to prevent class inheritance in C++

Nishtha Thakur
Answered 14h 55m ago

Here we will see how to prevent inheritance in C++. The concept of preventing the inheritance is known as final class.In Java or C#, we can use final classes. In C++ there are no such direct way. Here we will see how to simulate the final class in C++.Here we ... Read More

What does it mean when a numeric constant in C/C++ is prefixed with a 0?

Smita Kapse
Answered 14h 57m ago

Sometimes we may see some numeric literals, which is prefixed with 0. This indicates that the number is octal number. So octal literals contain 0 at the beginning. For example, if an octal number is 25, then we have to write 025.Example#include <stdio.h> int main() {    int a = ... Read More

wprintf() and wscanf in C Library

Anvi Jain
Answered 14h 58m ago

Here we will see the wprintf() and wscanf() functions in C. These are the printf() and scanf() functions for wide characters. These functions are present in the wchar.hThe wprintf() function is used to print the wide character to the standard output. The wide string format may contain the format specifiers ... Read More

Program for Christmas Tree in C

Nishtha Thakur
Answered 15h 2m ago

Here we will see one interesting problem. In this problem, we will see how to print Christmas tree randomly. So the tree will be flickering like Christmas tree lights.To print a Christmas tree, we will print pyramids of various sizes just one beneath another. For the decorative leaves a random ... Read More

Why strict aliasing is required in C?

Smita Kapse
Answered 15h 5m ago

Here we will see, why we should use the strict aliasing in C. Before discussing that part, let us see one code, and try to analyze the output.Example#include<stdio.h> int temp = 5; int* var = &temp; int my_function(double* var) {    temp = 1;    *var = 5.10; //this will change the value of temp    return (temp); } main() {    printf("%d",  my_function((double*)&temp)); }Output1717986918If we ... Read More

Linear search using Multi-threading in C

Anvi Jain
Answered 15h 6m ago

Here we will see how to apply the multi-threading concept to search one element in an array. Here the approach is very simple. We will create some threads, then divide the array into different parts. Different thread will search in different parts. After that, when the element is found, enable ... Read More

Print numbers in sequence using thread synchronization

Nishtha Thakur
Answered 15h 10m ago

Here we will see how to print numbers in a correct sequence using different threads. Here we will create n number of threads, then synchronize them. The idea is, the first thread will print 1, then second thread will print 2 and so on. When one thread is trying to ... Read More

What is data type of FILE in C?

Smita Kapse
Answered 15h 14m ago

In C we have used Files. To handle files, we use the pointer of type FILE. So the FILE is a datatype. This is called the Opaque datatype. So its implementation is hidden. The definition of the FILE is system specific. This is the definition of FILE in Ubuntu System ... Read More

Difference between fundamental data types and derived data types

Anvi Jain
Answered 15h 15m ago

Here we will see, what are the basic differences between fundamental data types and derived datatypes in C or C++.Fundamental DatatypesDerived DatatypesThe fundamental datatypes are also known as primitive datatypes.Derived datatypes are composed of fundamental datatypes.Some fundamental datatypes are int, char, float, void etc.Derived datatypes are arrays, structures, pointers etc.Integer ... Read More

Hygienic Macros in C

Nishtha Thakur
Answered 15h 18m ago

Here we will see the Hygienic Macros in C. We know the usage of macros in C. But sometimes, it does not return the desired results because of accidental capture of identifiers.If we see the following code, we can see that it is not working properly.Example#include<stdio.h> #define INCREMENT(i) do { ... Read More

Incompatibilities between C and C++

Smita Kapse
Answered 15h 21m ago

Here we will see some incompatibilities between C and C++. Some C codes that can be compiled using C compiler, but does not compile in C++ compiler. And also returns error.We can define function using a syntax, that optionally specify the argument types after the argument list.Example#include<stdio.h> void my_function(x, y)int ... Read More

Difference between fork() and exec() in C

Anvi Jain
Answered 15h 25m ago

Here we will see the effect of fork() and exec() system call in C. The fork is used to create a new process by duplicating the calling process. The new process is the child process. See the following property.The child process has its own unique process id.The parent process id ... Read More

Advertisements
Loading...
Unanswered Questions View All

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.