
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

7K+ Views
The function pow() is used to calculate the power raised to the base value. It takes two arguments. It returns the power raised to the base value. It is declared in “math.h” header file.Here is the syntax of pow() in C language, double pow(double val1, double val2);Here, val1 − The base value whose power is to be calculated.val2 − The power value.Here is an example of pow() in C language, Example#include #include int main() { double x = 5.5; double y = 4.0; double p; p = pow(x, y); printf("The value : %lf", p); ... Read More

21K+ Views
A static function in C is a function that has a scope that is limited to its object file. This means that the static function is only visible in its object file. A function can be declared as static function by placing the static keyword before the function name.An example that demonstrates this is given as follows −There are two files first_file.c and second_file.c. The contents of these files are given as follows −Contents of first_file.cstatic void staticFunc(void) { printf("Inside the static function staticFunc() "); }Contents of second_file.cint main() { staticFunc(); return 0; }Now, if the above ... Read More

2K+ Views
In C and C++ programming, the exit(), abort(), and assert() functions are used for program termination and debugging. Each of these functions have different purpose and defined in different header files. In this article, we will learn these functions and their usage with the help of examples. The exit() Function In C/C++, exit() function is used to terminate the function call immediately without the executing further processes. This function is defined in (in C) and / (in C++) header file and does not return any value. Syntax Following is the basic syntax of exit() function: void exit(int status_value); Here, ... Read More

731 Views
The function strftime() is used to format the time and date as a string. It is declared in “time.h” header file in C language. It returns the total number of characters copied to the string, if string fits in less than size characters otherwise, returns zero.Here is the syntax of strftime() in C language, size_t strftime(char *string, size_t size, const char *format, const struct tm *time_pointer)Here, string − Pointer to the destination array.size − Maximum number of characters to be copied.format − Some special format specifiers to represent the time in tm.time_pointer − Pointer to tm structure that contains the ... Read More

792 Views
Generally, we use header files in C/C++ languages to access the built-in functions like int, char, string functions. The function printf() is also a built-in function which is declared in “stdio.h” header file and it is used to print any kind of data on console.Here is an example to print without header files in C language, Exampleint printf(const char *text, ...); int main() { printf( "Hello World" ); return 0; }OutputHello WorldIn the above program, we printed “Hello World” without using any header file in the program by declaring the printf() function. The declaration of printf() is as ... Read More

2K+ Views
In C++, swapping two variables means exchanging the values stored in them. There can be multiple ways to implement the swapping using single line statement. In this article, we are going to learn some of the approaches to swap the values. Example Let's consider the following example with input and output scenario: Input: int a = 5; int b = 6; Output: a = 6 b = 5 You can implement swapping of two variable by using the following different ways: Using Arithmetic Operator Using Tuple Using XOR Swap Two Variables Using Arithmetic Operator In ... Read More

3K+ Views
In C/C++, a wild pointer is a type of pointer that has not been initialized to a valid memory address. It points to memory that has been deallocated and is called a dangling pointer. The pointer behaves like a wild pointer when it is declared but not initialized. That is why, they point to random memory location. Syntax The basic syntax of initializing wild pointer in C/C++: int *ptr; Example of Wild Pointer In this example, we create a pointer arr that doesn't assign it any memory. Then, it tries to print 5 values from it using a loop. ... Read More

4K+ Views
You can print the numbers from 1 to 100 without a loop by using the various methods like recursive function and goto statement that print the list of integers.The following are the approaches to print the numbers from 1 to 100: Using Recursion As we know, recursion is the process of calling the function itself. Here, we use the recursive function to accept an integer and set the iteration of plus 1 without the logic of loop and get the expected outcome. Example In this example, we use an if statement to check whether the given integer is less than ... Read More

1K+ Views
Both and "limits.h" are header files in C and C++ that are used to define constants related to data type limits. Header files are usually created with a .h extension and are used to declare functions, variables, and other entities without having a main() function. You can also create custom header files in C and C++. The header file is specific to the C++ language, whereas "limits.h" belongs to the C language. Let's discuss them one by one with the help of a suitable example to understand them and their uses in a program in a better way: ... Read More

147 Views
The function isgraph() is used to check that the passed character has a graphical representation or not. It is declared in “ctype.h” header file.Here is the syntax of isgraph() in C language, int isgraph(int char);Here is an example of isgraph() in C language, Example Live Demo#include #include int main() { int a = ''; int b = '8'; int c = 's'; if(isgraph(a)) printf("The character has graphical representation"); else printf("The character isn’t having graphical representation"); if(isgraph(b)) printf("The character has graphical representation"); else printf("The character isn’t having graphical representation"); if(isgraph(c)) ... Read More