
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

3K+ Views
In this section, we will see how to check whether a given character is number, or the alphabet or some special character in C.The alphabets are from A – Z and a – z, Then the numbers are from 0 – 9. And all other characters are special characters. So If we check the conditions using these criteria, we can easily find them.Example#include #include main() { char ch; printf("Enter a character: "); scanf("%c", &ch); if((ch >= 'A' && ch = 'a' && ch = '0' && ch

2K+ Views
Here we will see the kbhit functionality in C. The kbhit is basically the Keyboard Hit. This function is present at conio.h header file. So for using this, we have to include this header file into our code.The functionality of kbhit() is that, when a key is pressed it returns nonzero value, otherwise returns zero.Example#include #include main() { char ch; printf("Enter keys (ESC to exit)"); while (1) { //define infinite loop for taking keys if (kbhit) { ch = getch(); // Get typed character into ch ... Read More

9K+ Views
Here we will see what are the different types of C functions based on the return values and arguments.So a function either can take some arguments, or nothing is taken. Similarly, a function can return something, otherwise does not return anything. So we can categorize them into four types.Function with No argument and No return type.Function with No argument and Return something.A function that takes argument but returns nothing.Functions that take an argument and also return something.Example#include void my_function() { printf("This is a function that takes no argument, and returns nothing."); } main() { my_function(); }OutputThis is ... Read More

201 Views
In the cstdlib library of C++, there are different functions for getting the absolute value except from abs. The abs are used basically for int type input in C, and int, long, long long in C++. The others are used for long, and long long type data etc. Let us see the usage of these functions.The abs() FunctionThis function is used for int type data. So this returns the absolute value of the given argument. The syntax is like below.int abs(int argument)Example#include #include #include using namespace std; main() { int x = -145; int y = 145; cout

176 Views
The wcstoll() function is used to convert the wide character string to long long integers. It sets the pointer to point to the first character after the last one. The syntax is like below.long long wcstoll(const wchar_t* str, wchar_t** str_end, int base)This function takes three arguments. These arguments are like below −str: This is the starting of a wide string.str_end: The str_end is set by the function to the next character, after the last valid character, if there is any character, otherwise null.base: This specifies the base. The base values can be of (0, 2, 3, …, 35, 36)This function ... Read More

201 Views
Here we will see what is the use of ldexp() method in C or C++. This function returns any variable x raise to the power of exp value. This takes two arguments x and exp.The syntax is like below.float ldexp (float x, int exp) double ldexp (double x, int exp) long double ldexp (long double x, int exp) double ldexp (T x, int exp)Now let us see one example to get a better idea.Example#include #include using namespace std; int main() { double a = 10, res; int exp = 2; res = ldexp(a, exp); // Finds a*(2^exp) cout

579 Views
Here we will see what are the differences between qsort() in C, and sort() in C++.The C provides qsort() function, that can be used for sorting an array. The function arguments and syntax is like below.void qsort(void *base, size_t num, size_t size, int (*comparator) (const void*, const void*));This function takes the base address of that array, the number of elements of that array. Size of each item in the array, and a comparator function.The C++ provides sort() function. This is present inside C++ STL. The arguments and syntax is like below.void sort(T first, T last, Compare c);Here the order of ... Read More

12K+ Views
In C we have seen different format specifiers. Here we will see another format specifier called %p. This is used to print the pointer type data. Let us see the example to get a better idea.Example#include main() { int x = 50; int *ptr = &x; printf("The address is: %p, the value is %d", ptr, *ptr); }OutputThe address is: 000000000022FE44, the value is 50

37K+ Views
In C and C++, every character like 'A', 'b', '3', or '@' is stored as a number called its ASCII value. For example, 'A' is 65, and 'a' is 97. Given an integer like 97, we can convert it to its corresponding ASCII character which is 'a'. In this article, we will learn how to write a C and C++ program to convert an integer into its ASCII character. For example, we're given any integer from 0 to 127 (because the ASCII table contains 128 characters), and we need to convert it into its corresponding ASCII character: Input: 65 ... Read More

8K+ Views
In C and C++, arrays can store multiple values of the same data type. This problem is about finding how many elements are present in a statically declared int[] array (not pointers or dynamically allocated arrays). We'll learn how to find the size of an int[] in both C and C++. Let's understand this with an example: //Example 1 input: int numbers[] = {10, 20, 30, 40, 50}; This array has 5 elements. Output: Number of elements: 5 //Example 2: Input: int values[] = {1, 2, 3}; This array has 3 elements. Output: Number of elements: 3 ... Read More