Programming Articles

Page 943 of 2547

What is a two-dimensional array in C language?

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

A two-dimensional array in C is a collection of elements arranged in rows and columns, forming a matrix-like structure. It is essentially an array of arrays, where each element is identified by two indices: row index and column index. Syntax datatype array_name[row_size][column_size]; Example: int matrix[3][4]; declares a 2D array with 3 rows and 4 columns. Memory Layout Two-dimensional arrays are stored in row-major order in memory. Here's how a 2x3 array looks − 2D Array: int a[2][3] a[0][0] ...

Read More

Explain nested switch case in C language

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

Nested switch case in C allows you to place one switch statement inside another switch statement. This technique is useful when you need to perform multi-level decision-making based on different variables or conditions. Syntax switch (outer_expression) { case value1: switch (inner_expression) { case inner_value1: // statements ...

Read More

Explain different types of expressions in C program

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

An expression in C is a combination of operators and operands that evaluates to a single value. An operand is a data item on which an operation is performed, and an operator indicates the operation to be performed. Syntax operand operator operand operator operand operand ? operand : operand Types of Expressions C Expression Types Primary Unary Binary ...

Read More

What are executable statements in C language?

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

Executable statements in C are instructions that perform specific actions during program execution. The compiler translates these statements into machine code, which the processor can execute directly. Syntax statement; Types of Executable Statements The main types of executable statements in C language are − Input-output statements Assignment statements Control flow statements Function call statements Input-Output Statements Input-output statements handle data exchange between the program and the user − Input operation − Storing values from external sources into memory Output operation − Displaying computed results to the user ...

Read More

Explain variable declaration and rules of variables in C language

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

In C programming, a variable is a named memory location used to store data values. Variables are fundamental building blocks that allow programs to manipulate and store information during execution. What is a Variable? It is the name for memory location that may be used to store a data value. A variable may take different values at different times during execution. A variable name may be chosen by the programmer in a meaningful way, so as to reflect its function or nature in the program. For example: sum, avg, total, price, count etc. Rules ...

Read More

Explain about link and definition section in C language

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

In C programming, the link section and definition section are parts of preprocessor directives that provide instructions to the compiler before the actual compilation begins. The link section uses #include directives to include header files containing function declarations and definitions from system libraries. The definition section uses #define directives to create symbolic constants and macros. Syntax #include // Link section #define CONSTANT_NAME value // Definition section Link Section The link section tells the compiler which header files to include. This allows access to predefined functions and their ...

Read More

C program to handle integer data files using file concepts

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

In C, file handling allows us to work with different types of data including integers. This program demonstrates how to read integer data from one file and separate odd and even numbers into different files using file concepts. Syntax FILE *fopen(const char *filename, const char *mode); int putw(int w, FILE *stream); int getw(FILE *stream); int fclose(FILE *stream); Approach The program follows these steps − Create a DATA file and write integers to it Read integers from DATA file Separate odd numbers into ODD file and even numbers into EVEN file Display contents ...

Read More

Explain the pre-processor directives in C language

Aishwarya Naglot
Aishwarya Naglot
Updated on 15-Mar-2026 8K+ Views

The preprocessor is a tool that processes the source code before it passes through the compiler. It works as an initial phase of compilation where it operates under the control of different command lines or directives. Syntax #directive_name [parameters] Pre-processor Directives in C Preprocessor directives are placed in the source program before the main function, begin with the symbol "#" in column one and do not require a semicolon at the end. The commonly used preprocessor directives are − #define #undef #include #ifdef #endif #if #else The preprocessor directives ...

Read More

C program to display the prime numbers in between two intervals

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

In C programming, finding prime numbers between two intervals is a common problem that involves checking each number in the range for primality. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. Syntax for(i = start + 1; i < end; i++) { flag = 0; for(j = 2; j

Read More

Find the sum of first and last digit for a number using C language

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

In C programming, finding the sum of the first and last digit of a number involves extracting these digits using modulus and division operations. The last digit is obtained using modulus 10, while the first digit is found by repeatedly dividing the number by 10. Syntax int lastDigit = number % 10; while(number > 9) { number = number / 10; } int firstDigit = number; int sum = firstDigit + lastDigit; Algorithm The algorithm to find the sum of first and last digit is as follows − ...

Read More
Showing 9421–9430 of 25,466 articles
« Prev 1 941 942 943 944 945 2547 Next »
Advertisements