- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 1401 Articles for C
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
965 Views
ProblemFind the fraction part from two given integers given by user at run time by using the dynamic memory allocation and represent the numerator and denominator in string format.SolutionThe solution to represent the numerator and denominator in string format is as follows −Example -The input is given below −Numerator1 = 3 Denominator2 = 2 numerator2 = 4 denominator2 = 7The output is as follows −Fractional part1: 1.5 Fractional part2: 0.(571428)ExampleFollowing is the C program to represent the numerator and denominator in string format −#include #include #include #include char* fractionToDecimal(int numerator, int denominator) { char ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
5K+ Views
Depth First Search (DFS) is an algorithm which traverses a graph and visits all nodes before coming back it can determine. Also, it determines whether a path exist between two nodes. It searches a graph or tree in depth-wise manner. Algorithm Given below is an algorithm for the implementation of the Depth First Search (DFS) − Step 1 − Initially stack is empty. Step 2 − If a node to be visited is not present in the stack, then we push it onto the stack and mark it as visited. Step 3 − Then, check if the current node matches ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
3K+ Views
strtok_r() function in C language The strtok_r() function is similar to the strtok() function. The only key difference is that the _r, which is called as re-entrant function. A re-entrant function is a function which can be interrupted during its execution. This type of function can be used to resume execution. Because of this fact, re-entrant functions are thread-safe, means they can safely be interrupted by threads without any harm. strtok_r() function has an extra parameter called the context. so that function can resume at the right place. Syntax The syntax for strtok_r() function is as follows: // ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
911 Views
strtok() function is a part of the header file #include The syntax of strtok() function is as follows −char* strtok(char* string, const char* limiter);Input string string and a delimiter character limiter. strtok() will divide the string into tokens based on the delimited character.We can expect a list of strings from strtok(). But, the function returns a single string because after calling strtok(input, limiter), it will returns the first token.But we have to keep calling the function again and again on a NULL input string, until we get NULL! Generally, we used to keep calling strtok(NULL, delim) until it returns ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
3K+ Views
First, let us understand what is operator precedence in C programming language.Operator PrecedenceOperator precedence is used to evaluate the order of operators evaluated in an expression. In C programming, every operator has a priority. When there is more than one operator in the given expression, the operator with higher precedence or priority is evaluated first and the operator with the least priority is evaluated later.Operator AssociativityOperator associativity is used to evaluate the order of operators with equal precedence in an expression. In the C programming language, when an expression contains multiple operators with equal or same precedence, we use associativity ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
19K+ Views
When we want to develop a program by using any programming language, we have to follow a sequence of steps. These steps are called phases in program development.The program development life cycle is a set of steps or phases which are used to develop a program in any programming language.Phases of program developmentProgram development life cycle contains 6 phases, which are as follows −Problem Definition.Problem Analysis.Algorithm Development.Coding & Documentation.Testing & Debugging.Maintenance.These six phases are depicted in the diagram given below −Problem DefinitionHere, we define the problem statement and decide the boundaries of the problem.In this phase, we need to understand ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
15K+ Views
int main represents that the function returns some integer even ‘0’ at the end of the program execution. ‘0’ represents the successful execution of a program.The syntax of int main is as follows − int main(){ --- --- return 0; } int main(void) represents that the function takes NO argument. Suppose, if we don’t keep void in the bracket, the function will take any number of arguments.The syntax of int main(void) is as follows − int main(void){ --- --- return 0; } Actually, both seem to be the same but, ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
913 Views
string searching functions in C language The library also provides several string searching functions, which are as follows − char *strchr (const char *string, intc); Find first occurrence of character c in string. char *strrchr (const char *string, intc); Find last occurrence of character c in string. ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
755 Views
The library #include contains the basic memory operations. Although not strictly string functions, the functions are prototyped in #include . These memory operations are as follows − void *memchr (void *s, int c, size_t n); Search for a character in a buffer. int memcmp (void *s1, void *s2, size_t n); Compare two buffers. ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
10K+ Views
What is conditional compilation in C language? In C programming language, several directives control the selective compilation of portions of the program code. They are as follows − #if #else #elif #endif The general form of #if is as follows − #if constant_expression statement sequence #endif #else works much like the C keyword else. #elif means "else if" and establishes an if else-if compilation chain. Amongst other things, #if provides an alternative method of "commenting out" code. For example, #if 0 printf("#d", total); #endif Here, the compiler will ... Read More