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

Implicit return type int in C

Answered on 3rd May, 2019, 0 Views

If some function has no return type, then the return type will be int implicitly. If return type is not present, then it will not generate any error. However, C99 version does not allow return type to be omitted even if it is int. , ,

Difference between char s[] and char *s in C

Answered on 3rd May, 2019, 0 Views

We have seen sometimes the strings are made using char s[], or sometimes char *s. So here we will see is there any difference or they are same? There are some differences. The s[] is an array, but *s is a pointer. For an example, if two declarations are like char s[20], and char *s respectively, then by using sizeof() we will get 20, and 4. The first one will be 20 as it is showing that the.....

Variable length arguments for Macros in C

Answered on 3rd May, 2019, 0 Views

We know that we can use variable length arguments for functions in C. For that we have to use ellipsis (…). Similarly for macros, we can use variable length arguments. Here also we have to include ellipsis, The ‘__VA_ARGS__’ is used to handle variable length arguments. Concatenation operator ‘##’ is used to concatenate the variable arguments. In this example, .....

What is long long in C/C++?

Answered on 3rd May, 2019, 0 Views

In some cases we use long long in C or C++. Here we will see what is basically long long is? The long long takes twice as much memory as long. In different systems, the allocated memory space differs. On Linux environment the long takes 64-bit (8-bytes) of space, and the long long takes 128-bits (16-bytes) of space. This is used when we want to deal with some large value of integers. We can.....

How to check if an input is an integer using C/C++?

Answered on 3rd May, 2019, 0 Views

Here we will see how to check whether a given input is integer string or a normal string. The integer string will hold all characters that are in range 0 – 9. The solution is very simple, we will simply go through each characters one by one, and check whether it is numeric or not. If it is numeric, then point to the next, otherwise return false value. , , ,

How can I create directory tree using C++ in Linux?

Answered on 3rd May, 2019, 0 Views

In this section we will see how to create a directory tree using C++ code in Linux. In Linux terminal we can put some command like “mkdir –p /dir/dir1/dir2” Here –p is used to mark as parent (recursively create inner directories). In C++ code we can use some libraries of Linux system. Then we can use Linux terminal commands as string argument of the system() function.....

How to determine the version of the C++ standard used by the compiler?

Answered on 3rd May, 2019, 0 Views

Sometimes we need to know that, what is the current C++ standard. To get this kind of information, we can use the macro called __cplusplus. For different standards, the value of this will be like below. Standard__cplusplus outputC++ pre C++981C++98199711LC++98 + TR1This cannot be checked, this will be marked as C++98C++11201103LC++14201402LC++17201703L, ,

What is difference between instantiating a C++ object using new vs. without new?

Answered on 3rd May, 2019, 0 Views

In C++, we can instantiate the class object with or without using the new keyword. If the new keyword is not use, then it is like normal object. This will be stored at the stack section. This will be destroyed when the scope ends. But for the case when we want to allocate the space for the item dynamically, then we can create pointer of that class, and instantiate using new operator. In C++.....

Handling large numbers in C++?

Answered on 3rd May, 2019, 0 Views

In C++, we can use large numbers by using the boost library. This C++ boost library is widely used library. This is used for different sections. It has large domain of applications. For example, using boost, we can use large number like 264 in C++. Here we will see some examples of boost library. We can use big integer datatype. We can use different datatypes like int128_t, int256_t, int102.....

How to get memory usage at runtime using C++?

Answered on 3rd May, 2019, 0 Views

We can get the memory usage like virtual memory usage or resident set size etc. at run time. To get them we can use some system libraries. This process depends on operating systems. For this example, we are using Linux operating system. So here we will see how to get the memory usage statistics under Linux environment using C++. We can get all of the details from “/proc/self/stat&rdqu.....

loader
Advertisements
Contribution

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