Bhanu Priya

Bhanu Priya

1,061 Articles Published

Articles by Bhanu Priya

Page 51 of 107

Explain the concept of an array within a structure in C programming

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

An array within a structure in C programming is a powerful feature that allows you to group related data elements together. When you declare an array as a member of a structure, you can store multiple values of the same data type within a single structure variable. Syntax struct structure_name { datatype member1; datatype array_name[size]; datatype member2; }; General Structure Declaration The basic syntax for declaring a structure is − struct tagname { datatype member1; ...

Read More

C program demonstrating the concepts of strings using Pointers

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

In C programming, strings can be effectively manipulated using pointers. A string is essentially an array of characters terminated by a null character ('\0'). When we use pointers with strings, we can access and manipulate individual characters efficiently. Syntax char *pointer_name = "string_literal"; char *array_of_pointers[] = {"string1", "string2", "string3"}; String Declaration and Initialization Strings can be declared and initialized in multiple ways − Using character array: char string[50]; Using character constants: char string[10] = {'H', 'e', 'l', 'l', 'o', '\0'}; Using string literals: char string[10] = "Hello"; Using pointer to string: char ...

Read More

What is strncmp() Function in C language?

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

The C library function strncmp() compares at most the first n characters of two strings lexicographically. It returns an integer value indicating the relationship between the strings based on the first n characters. Syntax int strncmp(const char *str1, const char *str2, size_t n); Parameters str1 − First string to be compared str2 − Second string to be compared n − Maximum number of characters to compare Return Value 0 − If the first n characters of both strings are equal Positive value − If str1 is lexicographically greater than ...

Read More

What is strncat() Function in C language?

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

In C, the strncat() function is used to concatenate a specified number of characters from one string to the end of another string. It appends at most n characters from the source string to the destination string. Syntax char *strncat(char *dest, const char *src, size_t n); Parameters dest − Pointer to the destination string where characters will be appended src − Pointer to the source string from which characters will be copied n − Maximum number of characters to append from source Return Value The function returns a pointer to ...

Read More

What is pass by value in C language?

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

Pass by value is a parameter passing mechanism in C programming where the actual value of arguments is copied to the function's formal parameters. When you pass variables to a function using pass by value, the function receives copies of the values, not the original variables themselves. Syntax return_type function_name(data_type parameter1, data_type parameter2, ...); How Pass by Value Works When using pass by value: The function receives copies of the argument values Changes made to parameters inside the function do not affect the original variables Memory is allocated separately for function parameters ...

Read More

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
Showing 501–510 of 1,061 articles
« Prev 1 49 50 51 52 53 107 Next »
Advertisements