Found 1339 Articles for C

What are string searching functions in C language?

Sindhura Repala
Updated on 24-Jan-2025 13:08:11

2K+ Views

String Searching Functions The C string functions are built-in functions used for various operations and manipulations on strings. These functions perform tasks such as copying, comparing, concatenation, and determining the length of strings. The library also provides several string-searching functions, which are included as follows − Function Description ... Read More

What are memory operations in C language?

Bhanu Priya
Updated on 20-Jun-2024 00:33:01

1K+ 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

What is conditional compilation in C language?

Sindhura Repala
Updated on 18-Dec-2024 17:18:13

14K+ Views

In C programming language, several directives control the selective compilation of different parts of the program code. Conditional Compilation is a set of preprocessing directives that allows us to exclude and include parts of a program based on specified conditions. Each directive in the compilation is processed across different platforms, including debug and release versions. They are as follows − #if #else #elif #endif The "#if" Directory The #if is a directive preprocessor that evaluates the expression or condition. If the condition ... Read More

Differentiate between array and structures in C

Bhanu Priya
Updated on 02-Sep-2021 13:17:30

338 Views

The major differences between an array and a structure in C programming language are as follows −ArraysStructuresAn array is a single entity representing a collection of data items of same data types.A structure is a single entity representing a collection of data items of different data types.Individual entries in an array are called elements.Individual entries in a structure are called members.An array declaration reserves enough memory space for its elements.The structure definition reserves enough memory space for its members.There is no keyword to represent arrays but the square braces [] preceding the variable name tells us that we are dealing ... Read More

C program to store inventory system using structures

Bhanu Priya
Updated on 01-Sep-2021 13:18:41

9K+ Views

Structure is a collection of different datatype variables, grouped together under a single name.Features of structureThe 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 its type by using an assignment operator.For handling the complex datatypes, it is better to create structure within another structure, which is called nested structures.It is possible to pass an entire structure, individual elements of structure and an address of structure to a function.It is possible to create structure pointers.ProgramFollowing is the C ... Read More

C program to sort names in alphabetical order using structures

Bhanu Priya
Updated on 02-Sep-2023 13:54:56

5K+ Views

Structure is a collection of different datatype variables, grouped together under a single name.Features of structureThe 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 its type by using an assignment operator.For handling the complex datatypes, it is better to create structure within another structure, which is called nested structures.It is possible to pass an entire structure, individual elements of structure and an address of structure to a function.It is possible to create structure pointers.Declaration and initialization of ... Read More

C program to compare if the two matrices are equal or not

Bhanu Priya
Updated on 01-Sep-2021 13:13:28

3K+ Views

The user has to enter the order of two matrices and elements of two matrices. Then, these two matrix are compared.If both matrix elements and size are equal, then it displays that the two matrices are equal.If size of matrix is equal but the elements are not equal, then it displays that the matrix can be compared but is not equal.If the size and elements are not matched, then it displays that the matrices cannot be compared.ProgramFollowing is the C program to compare if the two matrices are equal or not −#include #include main(){    int A[10][10], B[10][10]; ... Read More

C program to sort all columns and rows of matrix

Bhanu Priya
Updated on 01-Sep-2021 13:10:15

5K+ Views

ProblemWrite a code to sort all the rows of matrix in an ascending order and all columns in the descending order. The size of matrix and elements of matrix are given by user at runtime.SolutionThe solution to sort all the rows of matrix in an ascending order and all columns in the descending order in the C programming language is explained below −The logic used to sort the rows in an ascending order is as follows −for (i=0;i

C program to interchange the diagonal elements in given matrix

Bhanu Priya
Updated on 01-Sep-2021 13:07:55

1K+ Views

ProblemWe need to write a code to interchange the main diagonal elements with the secondary diagonal elements. The size of the matrix is given at runtime.If the size of matrix m and n values are not equal, then it prints that the given matrix is not a square.Only a square matrix can interchange the main diagonal elements and can interchange with the secondary diagonal elements.SolutionThe solution to write a C program to interchange the diagonal elements in given matrix is as follows −The logic to interchange the diagonal elements is explained below −for (i=0;i

C program to perform operations on two halves’ in a single array

Bhanu Priya
Updated on 01-Sep-2021 13:05:11

827 Views

ProblemWrite a program to accept a one-dimensional array of N elements and split into two halves. Later on, sort the first half in an ascending order and the second half into descending order.SolutionThe solution to perform the two operations on two halves’ in a single array in C programming language is explained below −The logic used to sort the first half in an ascending order is as follows −for (i=0; i

Previous 1 ... 5 6 7 8 9 ... 134 Next
Advertisements