-
Can a variable be both const and volatile?
Yes. The const modifier means that this code cannot change the value of the variable, but that does not mean that the value cannot be changed by means outside this code. For instance, in the example in FAQ 8, the timer structure was accessed through a volatile const pointer. The function itself did not change the value of the timer, so it was declared const. However, the value was changed by...
-
Can static variables be declared in a header file?
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 file, but this would cause each source file that included the header file to have its own private copy of the variable, which is probably not what was intended.
-
What is the difference between a string and an array?
An array is an array of anything. A string is a specific kind of an array with a well-known convention to determine its length. There are two kinds of programming languages: those in which a string is just an array of characters, and those in which it’s a special type. In C, a string is just an array of characters (type char), with one wrinkle: a C string always ends with a NUL character. The “value”...
-
-
-
-
-
-
-
-
-
-
-
C is not platform dependent.Why?
we know that C is not platform independent.but if we make a program on a operating system and copy the same program on other os without any changes then this program will run after compiling and will give the same answer.
so if same program will run on other os then why C is not platform independent.
-
C Pyramid Program
1
1 2 2
1 2 2 3 3
1 2 2 3 3 4 4
how to create this pyramid using cWhen should a type cast be used?
There are two situations in which to use a type cast. The first use is to change the type of an operand to an arithmetic operation so that the operation will be performed properly. The second case is to cast pointer types to and from void * in order to interface with functions that expect or return void pointers. For example, the following line type casts the return value of the call to malloc()...
What are the characteristics of arrays in C?
1) An array holds elements that have the same data type 2) Array elements are stored in subsequent memory locations3) Two-dimentional array elements are stored row by row in subsequent memory locations.4) Array name represents the address of the starting element5) Array size should be mentioned in the declaration. Array size must be a constant expression...
Ans