C Articles

Page 6 of 96

C program to print Excel column titles based on given column number

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 861 Views

In C programming, converting a column number to its corresponding Excel column title is a common problem. Excel columns are labeled as A, B, C, ..., Z, AA, AB, AC, and so on. This follows a base-26 numbering system where A=1, B=2, ..., Z=26, AA=27, etc. Syntax char* convertToExcelTitle(int columnNumber); Algorithm The algorithm works by repeatedly dividing the column number by 26 and converting the remainder to the corresponding character − Subtract 1 from the column number to make it 0-indexed Find the remainder when divided by 26 and convert to character ...

Read More

C program to represent numbers in numerator and denominator in string format

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 1K+ Views

In C, we can convert fractions to their decimal string representation using dynamic memory allocation. This program handles both terminating and repeating decimal fractions, representing repeating decimals with parentheses. Syntax char* fractionToDecimal(int numerator, int denominator); Algorithm The algorithm works by performing long division and tracking remainders to detect repeating cycles − Calculate the integer part using division Use the remainder to compute decimal digits Store each remainder to detect when a cycle begins Mark repeating portions with parentheses Example Following is the C program to represent fractions in decimal ...

Read More

What is strtok_r() function in C language?

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 4K+ Views

The strtok_r() function is a thread-safe alternative to the strtok() function for tokenizing strings. The "_r" suffix stands for "re-entrant, " meaning this function can be safely interrupted and resumed without losing its state. This makes it ideal for multi-threaded applications where multiple threads might need to tokenize strings simultaneously. A re-entrant function can be interrupted during execution and safely resumed later. Because strtok_r() maintains its context through an external pointer, it avoids the static variable issues that make strtok() non-thread-safe. Syntax char *strtok_r(char *str, const char *delim, char **saveptr); Parameters str ...

Read More

What is C Operator Precedence and Associativity?

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 3K+ Views

In C programming, operator precedence and associativity determine the order in which operators are evaluated in complex expressions. Understanding these concepts is crucial for writing correct C programs and predicting expression results. Operator Precedence Operator precedence defines the priority order in which operators are evaluated in an expression. When multiple operators exist in an expression, the operator with higher precedence is evaluated first. For example, multiplication has higher precedence than addition. Syntax expression = operand1 operator1 operand2 operator2 operand3 /* Evaluation order depends on operator precedence and associativity */ Operator Associativity Operator ...

Read More

What is program development cycle in C language?

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 28K+ 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. Syntax Program Development Life Cycle: 1. Problem Definition 2. Problem Analysis 3. Algorithm Development 4. Coding & Documentation 5. Testing & Debugging 6. Maintenance Phases of Program Development Program development life cycle contains 6 phases, which are as follows − ...

Read More

Differentiate between int main and int main(void) function in C

Sindhura Repala
Sindhura Repala
Updated on 15-Mar-2026 16K+ Views

In C programming, there is a subtle but important difference between int main() and int main(void). Both declare the main function to return an integer, but they differ in how they handle function parameters. Syntax int main() { // Function body return 0; } int main(void) { // Function body return 0; } The int main() Function The int main() function with empty parentheses indicates that the function can accept any number of arguments. In C, when ...

Read More

What are string searching functions in C language?

Sindhura Repala
Sindhura Repala
Updated on 15-Mar-2026 2K+ Views

String searching functions in C are built-in library functions that help locate specific characters, substrings, or patterns within strings. These functions are part of the standard C library (string.h) and provide efficient ways to search and analyze string content. Syntax #include char *strchr(const char *str, int c); char *strrchr(const char *str, int c); char *strpbrk(const char *s1, const char *s2); size_t strspn(const char *s1, const char *s2); size_t strcspn(const char *s1, const char *s2); char *strtok(char *s1, const char *s2); char *strtok_r(char *s1, const char *s2, char **saveptr); String Searching Functions Overview ...

Read More

What are memory operations in C language?

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 1K+ Views

Memory operations in C are functions that manipulate raw bytes in memory, regardless of data type. These functions are declared in #include and work with void* pointers to handle any data type. Syntax The five primary memory functions have the following prototypes − void *memchr(const void *s, int c, size_t n); int memcmp(const void *s1, const void *s2, size_t n); void *memcpy(void *dest, const void *src, size_t n); void *memmove(void *dest, const void *src, size_t n); void *memset(void *s, int c, size_t n); Memory Functions Overview ...

Read More

C program to store inventory system using structures

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 9K+ Views

In C programming, an inventory management system can be efficiently implemented using structures to store and organize product information. Structures allow us to group related data of different types under a single entity, making it perfect for managing inventory details like item names, codes, quantities, prices, and manufacturing dates. Syntax struct structure_name { datatype member1; datatype member2; /* more members */ }; Features of Structures The key features of structures in C programming are − Enables grouping of different data ...

Read More

C program to sort names in alphabetical order using structures

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 6K+ Views

Structure is a collection of different datatype variables, grouped together under a single name. In this article, we will learn how to sort names in alphabetical order using structures in C. Syntax struct structure_name { datatype member1; datatype member2; // ... more members }; Features of Structure The features of structure in the C programming language are as follows − It is possible to copy the contents of all the structure elements of different datatypes to another structure variable of ...

Read More
Showing 51–60 of 953 articles
« Prev 1 4 5 6 7 8 96 Next »
Advertisements