An lvalue was defined as an expression to which a value can be assigned. Is an array an expression to which we can assign a value? The answer to this question is no, because an array is composed of several
Latest Answer : Array is not an lvalue..Eg.int arr[5] = {"1","2",.......};here arr[5] has memory address and now we are assinging values to this.if we write arr[5]; in any function then it will not show any error, mean array does required lvalue ...
A global variable that must be accessed from more than one file can and should be declared in a header file. In addition, such a variable must be defined in one source file. Variables should not be defined
Latest Answer : A variable can be declare/define in a C Header without any kind of compilational/ logical errors. But it is against the coding specifications and it is not normally practiced. If proper Multiple inclusion protection macro is used, then there will be no ...
Declaring a variable means describing its type to the compiler but not allocating any space for it. Defining a variable means declaring it and also allocating space to hold the variable. You can also
Latest Answer : int num;This statement is declaration and also defination since it also allocates memory for variable num.But when you use following statementextern int num;It is only declaration since you are not allocating memory here. ...
You can’t declare a static variable without defining it as well (this is because the storage class modifiers static and extern are mutually exclusive). A static variable can be defined in a header
Latest Answer : In CThe scope of static variable is file. ie., if declared the variable is accessible accross the file.When declared the vairable in a header then its exposed to where ever its included. Every file will have a local copy. You need to extern ...
The benefit of using the const keyword is that the compiler might be able to make optimizations based on the knowledge that the value of the variable will not change. In addition, the compiler will try
Latest Answer : A side effect benefit:Say you want to pass an argument that you do not want modified, but you do not want to pass by value.Solution pass as constant reference or pointer constant.int someFoo(myDataType const &chunkOfData);orint ...
One easy technique to avoid multiple inclusions of the same header is to use the #ifndef and #define preprocessor directives. When you create a header for your program, you can #define a symbolic name
The preprocessor will include whatever file you specify in your #include statement. Therefore, if you have the line #include in your program, the file macros.inc will be included in
Latest Answer : no ...
Using the #define method of declaring a constant enables you to declare a constant in one place and use it throughout your program. This helps make your programs more maintainable, because you need to
Latest Answer : When you define constant variable there is possiblity that it's value may get changed in the program accidently by use of say pointer, but if you define constant by #define it's value can't be changed. This is also one of the benifit ...
The ANSI C standard defines six predefined macros for use in the C language: Macro Name Purpose _ _LINE_ _ Inserts the current source code line number in your code. _ _FILE_ _ Inserts the current source
You can use the #undef preprocessor directive to undefine (override) a previously defined macro.