l-value or location value refers to an expression that can be used on left side of assignment operator. For example in expression “a = 3”, a is l-value and 3 is r-value. l-values are of two types: “nonmodifiable l-value” represent a l-value that can not be modified. const variables are “nonmodifiable l-value”. “modifiable l-value” represent a l-value that can be modified.
-
-
1) The expression ‘i++’ returns the old value and then increments i. The expression ++i increments the value and returns new value. 2) Precedence of postfix ++ is higher than that of prefix ++. 3) Associativity of postfix ++ is left to right and associativity of prefix ++ is right to left. 4) In C++, ++i can be used as l-value, but i++ cannot be. In C, they both cannot be used as l-value.
-
Uninitialized pointers in the C code are known as Wild Pointers. These are a point to some arbitrary memory location and can cause bad program behavior or program crash.
-
C is a procedural language. The main features of C language include low-level access to memory, simple set of keywords, and clean style. These features make it suitable for system programming like operating system or compiler development.
-
Both functions are to retrieve absolute value. abs() is for integer values and fabs() is for floating type numbers. Prototype for abs() is under the library file < stdlib.h > and fabs() is under < math.h >.
-
A function, which has a function definition prefixed with a static keyword is defined as a static function. The static function should call within the same source code. In C, functions are global by default. The “static” keyword before a function name makes it static. Unlike global functions in C, access to static functions is restricted to the file where they are declared. Therefore, when we want to restrict access to functions, we make them static. Another reason for making functions static can be reuse of the same function name in other files.
-
A local static variable is a variable whose lifetime doesn’t end with a function call where it is declared. It extends for the lifetime of complete program. All calls to the function share the same copy of local static variables. Static variables can be used to count the number of times a function is called. Also, static variables get the default value as 0. For example, the following program prints “0 1” #include <stdio.h> void fun() { // static variables get the default value as 0. static int x; printf("%d ", x); x = x + 1; } int main()…
-
The words that are part of the slandered C language library are called reserved words. Those reserved words have special meaning and it is not possible to use them for any activity other than its intended functionality. Example void, return int.
-
Break can appear only with in the looping control and switch statement. The purpose of the break is to bring the control out from the said blocks.
-
There are two possible methods to perform this task. 1) Use increment (++) and decrement (-) operator. Example When x=4, x++ returns 5 and x- returns 3. 2) Use conventional + or – sign. When x=4, use x+1 to get 5 and x-1 to get 3.