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
Cover Image
Cover Image
Drag to reposition
Contributed Answers

Interesting Facts about C Programming

Answered 1d 7h ago, 0 Views

Here we will see some interesting facts about C programming. These are like below. Sometimes the case labels of some switch statement can be placed inside if-else statement., , The array[index] can be written as index[array]. The reason is array elements are accessed using pointer arithmetic. The value of array[5] is *(array + 5). If this is in the reverse order like 5[array], then also thi.....

How to determine whether C++ code has been compiled in 32 or 64 bit?

Answered 2d 2h ago, 0 Views

In C++, there is no direct way to check the environment architecture. There are two Macros for Windows systems, that can be used to check the architecture. These macros are _WIN64, and _WIN32. When the system is 64-bit, then the _WIN64 will be 1, otherwise the _WIN32 will be 1. So using macro checking, we can identify the architecture , ,

How do I terminate a thread in C++11?

Answered 2d 2h ago, 0 Views

Here we will see, how to terminate the threads in C++11. The C++11 does not have direct method to terminate the threads. The std::future<void> can be used to the thread, and it should exit when value in future is available. If we want to send a signal to the thread, but does not send the actual value, we can pass void type object. To create one promise object, we have to follow this s.....

Floating point comparison in C++

Answered 2d 3h ago, 0 Views

Here we will see how to compare two floating point data using C++. The floating point comparison is not similar to the integer comparison. To compare two floating point values, we have to consider the precision in to the comparison. For example, if two numbers are 3.1428 and 3.1415, then they are same up to the precision 0.01, but after that, like 0.001 they are not same. To compare using t.....

When should I write the keyword 'inline' for a function/method in C++?

Answered 2d 3h ago, 0 Views

In C++, the inline keyword is used in different places. To create inline variables, or inline namespace, and as well as to create inline methods or functions. C++ inline function is powerful concept that is commonly used with classes. If a function is inline, the compiler places a copy of the code of that function at each point where the function is called at compile time. Any change to an .....

What is the difference between const int*, const int * const, and int const *?

Answered 2d 3h ago, 0 Views

Here we will see some different types of variable declaration based on integer pointers integer constants and the integer constant pointers. To determine them we will use the Clockwise/Spiral Rule. By discussing the terms, we can understand the rules also. The const int *. This is used to tell the compiler that this is a pointer type variable, and this can store address of some constant int.....

What is a null-terminated string in C/C++?

Answered 2d 3h ago, 0 Views

In C the strings are basically array of characters. In C++ the std::string is an advancement of that array. There are some additional features with the traditional character array. The null terminated strings are basically a sequence of characters, and the last element is one null character (denoted by ‘\0’). When we write some string using double quotes (“…”).....

Reverse a string in C/C++ using Client Server model

Answered 2d 3h ago, 0 Views

Here we will see how we can create a system, where we will create one client, and a server, and the client can send one string to the server, and the server will reverse the string, and return back to the client. Here we will use the concept of socket programming. To make the client server connection, we have to create port. The port number is one arbitrary number that can be used by the so.....

How to use POSIX semaphores in C language

Answered on 6th May, 2019, 0 Views

The semaphore is a concept of process or thread synchronization. Here we will see how to use the semaphores in real programs. In Linux system, we can get the POSIX semaphore library. To use it, we have to include semaphores.h library. We have to compile the code using the following options. , We can use sem_wait() to lock or wait. And sem_post() to release the lock. The semaphore initialize.....

Generating random number in a range in C

Answered on 6th May, 2019, 0 Views

Here we will see how to generate random number in given range using C. To solve this problem, we will use the srand() function. The current time will be used to seed the srad() function. This function cannot generate random number in any range, it can generate number between 0 to some value. So for it, we have to follow one trick. We will generate random number in between 0 to (upper &ndash.....

loader
Advertisements
Contribution

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