Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Server Side Programming Articles
Page 924 of 2109
What is strncat() Function in C language?
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 MoreWhat is pass by value in C language?
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 MoreWhat is a two-dimensional array in C language?
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 MoreExplain nested switch case in C language
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 MoreExplain different types of expressions in C program
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 MoreWhat are executable statements in C language?
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 MoreExplain variable declaration and rules of variables in C language
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 MoreExplain about link and definition section in C language
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 MoreC program to handle integer data files using file concepts
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 MoreExplain the pre-processor directives in C language
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