Server Side Programming Articles

Page 987 of 2109

What does the operation c=a+++b mean in C/C++?

Aman Kumar
Aman Kumar
Updated on 15-Mar-2026 2K+ Views

In C, the expression c = a+++b is parsed by the compiler using the "maximal munch" rule, which means it reads the longest possible token sequence. This expression is interpreted as c = (a++) + b, where a++ is the post-increment operator applied to variable a. Syntax c = a++ + b; // Post-increment a, then add b c = a + ++b; // Pre-increment b, then add to a The key difference lies in operator precedence and associativity. The post-increment operator (++) has higher precedence than the addition ...

Read More

Enumerations in PHP

Pradeep Kumar
Pradeep Kumar
Updated on 15-Mar-2026 287 Views

Enumerations in PHP provide a way to define a fixed set of named constants, making your code more readable and preventing invalid values. While older PHP versions required workarounds, PHP 8.1 introduced native enum support. Native Enums (PHP 8.1+) PHP 8.1 introduced true enumeration support with the enum keyword − Order status: PENDING Order status: APPROVED Backed Enums Backed enums allow you to assign specific values to enum cases − Priority value: 3 Priority name: HIGH From value 2: MEDIUM Legacy ...

Read More

_Noreturn function specifier in C

Ravi Ranjan
Ravi Ranjan
Updated on 15-Mar-2026 361 Views

The _Noreturn function specifier in C indicates to the compiler that a function will never return control to its caller. Functions marked with _Noreturn either terminate the program (using exit()) or run indefinitely (infinite loops). This helps the compiler optimize code and detect unreachable statements. Syntax _Noreturn return_type function_name(parameters) { /* Function body that never returns */ } Example 1: _Noreturn with exit() Function When a function marked with _Noreturn calls exit(), it terminates the program without returning control to the caller − #include #include ...

Read More

How do the PHP equality (== double equals) and identity (=== triple equals) comparison operators differ?

Pradeep Kumar
Pradeep Kumar
Updated on 15-Mar-2026 773 Views

In PHP, the double equals (==) and triple equals (===) are comparison operators used to compare values for equality. However, they differ in terms of their behaviour and the level of strictness in the comparison process. Double Equals (==) The double equals operator checks for equality between two values, but it performs type coercion if the two values have different data types. This means that PHP will attempt to convert the values to a common type before performing the comparison. Here are some key points about the double equals operator − If ...

Read More

What happens when a function is called before its declaration in C?

Jennifer Nicholas
Jennifer Nicholas
Updated on 15-Mar-2026 440 Views

In C programming, when a function is called before its declaration, the compiler makes an assumption about the function's return type. If no prototype is provided, the compiler assumes the function returns an int by default. This can lead to compilation errors if the actual function returns a different type. Syntax return_type function_name(parameters); // Function declaration/prototype Example 1: Error with Non-Integer Return Type When a function returns a type other than int but is called before declaration, it causes a type conflict − #include int main() { ...

Read More

What is evaluation order of function parameters in C?

Jennifer Nicholas
Jennifer Nicholas
Updated on 15-Mar-2026 722 Views

In C programming, when we pass arguments to a function, a common question arises: what is the order of evaluation of function parameters? Is it left to right, or right to left? The C standard does not specify the evaluation order, making it implementation-defined behavior. Syntax function_name(arg1, arg2, arg3, ...); Example: Testing Parameter Evaluation Order Let's examine a program that demonstrates the evaluation order by using side effects − #include void test_function(int x, int y, int z) { printf("The value of x: %d", x); ...

Read More

Determine The First And Last Iteration In A Foreach Loop In PHP

Pradeep Kumar
Pradeep Kumar
Updated on 15-Mar-2026 3K+ Views

In PHP, foreach loops don't provide built-in methods to identify the first and last iterations. However, you can use counter variables or array functions to determine when you're at the beginning or end of the loop. Method 1: Using Counter Variable The most straightforward approach is to track iterations with a counter variable − First item: 1 Current item: 1 Current item: 2 Current item: 3 Current item: 4 Last item: 5 Current item: 5 Method 2: Using Array Key Functions PHP provides functions to get the first and ...

Read More

How to Count Variable Numbers of Arguments in C?

Nitya Raut
Nitya Raut
Updated on 15-Mar-2026 2K+ Views

In C programming, the ellipsis (...) allows functions to accept a variable number of arguments. To count these arguments, C provides three common approaches − passing the count as the first parameter, using NULL as a sentinel value, or parsing format specifiers like printf() does. Syntax #include return_type function_name(fixed_params, ...); va_list ap; va_start(ap, last_fixed_param); type value = va_arg(ap, type); va_end(ap); Method 1: Using Count Parameter The most straightforward approach is to pass the number of arguments as the first parameter − #include #include int get_sum(int count, ...) ...

Read More

Deleting All Files From A Folder Using PHP

Pradeep Kumar
Pradeep Kumar
Updated on 15-Mar-2026 1K+ Views

In PHP, you can delete all files from a folder using built−in functions like glob() and scandir(). Both methods provide efficient ways to iterate through directory contents and remove files programmatically. Using glob() Function The glob() function searches for files matching a specified pattern and returns an array of file paths ? Syntax array|false glob(string $pattern, int $flags = 0) Parameters $pattern − The search pattern (e.g., "folder/*" for all files) $flags (optional) − Modifies behavior with flags like GLOB_ONLYDIR, GLOB_NOSORT ...

Read More

Functions that are executed before and after main() in C

Vrundesha Joshi
Vrundesha Joshi
Updated on 15-Mar-2026 3K+ Views

Here we will see how to write a code where two functions are present, and one function will be executed before the main function, and another function will be executed after the main function. These features are used to do some startup task before executing the main, and some cleanup task after executing main. To do this task we have to put attribute for these two functions. When the attribute is constructor attribute, then it will be executed before main(), and when the attribute is destructor type, then it will be executed after main(). Syntax void ...

Read More
Showing 9861–9870 of 21,090 articles
« Prev 1 985 986 987 988 989 2109 Next »
Advertisements