< 1 2 3 4 5 6 7 > >>   Sort: Date

"const" and "volatile"
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, a timer structure can be accessed through a volatile const pointer. The f...
2007-02-26, 7197👍, 0💬

Shift Operators
What will be printed as the result of the operation below: main() { int x=5; printf("%d,%d,%d\n",x,x&lt ;&lt;2,x&gt;&gt;2) ;} As x = 5 = 0x0000,0101; so x &lt;&lt; 2 -&lt; 0x0001,0100 = 20; x &gt;&gt; 2 -&gt; 0x0000,0001 = 1. Therefore, the answer is 5, 20, 1.
2007-02-26, 7193👍, 0💬

malloc Function
Why does malloc(0) return valid memory address? What's the use? malloc(0) does not return a non-NULL under every implementation. An implementation is free to behave in a manner it finds suitable, if the allocation size requested is zero. The implmentation may choose any of the following actions: * A...
2007-02-26, 7119👍, 0💬

What is wrong with this initialization?
What's wrong with this initialization? char *p = malloc(10); My compiler is complaining about an ``invalid initializer'', or something. Is the declaration of a static or non-local variable? Function calls are allowed in initializers only for automatic variables (that is, for local, non-static variab...
2020-08-03, 7110👍, 2💬

💬 2020-08-03 chelseaclark: Evidence for GPCR dimerization comes from biochemical, biophysical and functional studies. https://dda.creative-bioarray.com/re c...

💬 2020-05-27 james: very helpful thanks

What does static variable mean
What does static variable mean? There are 3 main uses for static variables: If you declare within a function, it retains the value between function calls. If it is declared for a function name, by default function is extern. So it will be visible from other files. If the function declaration is as s...
2007-02-26, 7097👍, 0💬

Storage Classes
What are the different storage classes in C? C has three types of storage: automatic, static and allocated. Variable having block scope and without static specifier have automatic storage duration. Variables with block scope, and with static specifier have static scope. Global variables (i.e, file s...
2007-02-26, 7081👍, 0💬

Including Source Files
What is the result of using Option Explicit? When writing your C program, you can include files in two ways. The first way is to surround the file you want to include with the angled brackets &lt; and &gt;. This method of inclusion tells the preprocessor to look for the file in the predefine...
2007-02-26, 7064👍, 0💬

Constants
WHat will be the result of the following code? #define TRUE 0 // some code while (TRUE) { // some code } Answer: This will not go into the loop as TRUE is defined as 0.
2007-02-26, 6994👍, 0💬

Modulation Operations
Write an equivalent expression for x%8? x&amp;7
2007-02-26, 6977👍, 0💬

Using Macros for Contants
What is the benefit of using #define to declare a constant? 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 maintain only the #define statement and...
2007-02-26, 6958👍, 0💬

Searching Date in Linked Lists
How can I search for data in a linked list? Unfortunately, the only way to search a linked list is with a linear search, because the only way a linked list's members can be accessed is sequentially. Sometimes it is quicker to take the data from a linked list and store it in a different data structur...
2007-02-26, 6929👍, 0💬

What Is Hashing
What is hashing? To hash means to grind up, and that's essentially what hashing is all about. The heart of a hashing algorithm is a hash function that takes your nice, neat data and grinds it into some random-looking integer. The idea behind hashing is that some data either has no inherent ordering ...
2007-02-26, 6890👍, 0💬

Incremental Operatiors
What will be printed as the result of the operation below: main() { int x=10, y=15; x = x++; y = ++y; printf("%d %d\n",x,y); } Answer: 11, 16
2007-02-26, 6880👍, 0💬

Strings vs. Character Arrays
What is the difference between strings and character arrays? A major difference is: string will have static storage duration, whereas as a character array will not, unless it is explicity specified by using the static keyword. Actually, a string is a character array with following properties: * the ...
2007-02-26, 6858👍, 0💬

"volatile" Modifier
when should the volatile modifier be used? The volatile modifier is a directive to the compiler's optimizer that operations involving this variable should not be optimized in certain ways. There are two special cases in which use of the volatile modifier is desirable. The first case involves memory-...
2007-02-26, 6845👍, 0💬

Using Pointers
What print out will the folloging code produce? main() { char *p1=“name”; char *p2; p2=(char*)malloc(20); memset (p2, 0, 20); while(*p2++ = *p1++); printf(“%s\n”,p2);> } The pointer p2 value is also increasing with p1 . *p2++ = *p1++ means copy value of *p1 to *p2 , then increment both addresses (p...
2007-02-26, 6837👍, 0💬

Nesting Include Files
Can include files be nested? The answer is yes. Include files can be nested any number of times. As long as you use precautionary measures , you can avoid including the same file twice. In the past, nesting header files was seen as bad programming practice, because it complicates the dependency trac...
2007-02-26, 6811👍, 0💬

What is page thrashing
What is page thrashing? Some operating systems (such as UNIX or Windows in enhanced mode) use virtual memory. Virtual memory is a technique for making a machine behave as if it had more memory than it really has, by using disk space to simulate RAM (random-access memory). In the 80386 and higher Int...
2007-02-26, 6807👍, 0💬

Incremental Operatos
What will be printed as the result of the operation below: main() { int x=20,y=35; x=y++ + x++; y= ++y + ++x; printf("%d%d\n",x,y); } Answer : 5794
2007-02-26, 6805👍, 0💬

Function Calls
What will be printed as the resultof the operation below: int x; int modifyvalue() { return(x+=10); } int changevalue(int x) { return(x+=1); } void main() { int x=10; x++; changevalue(x); x++; modifyvalue(); printf("First output:%d\n",x); x++; changevalue(x); printf("Second output:%d\n",x); modifyva...
2007-02-26, 6778👍, 0💬

Function Calls
What will be printed as the result of the operation below: #define swap(a,b) a=a+b;b=a-b;a=a-b; void main() { int x=5, y=10; swap (x,y); printf("%d %d\n",x,y); swap2(x,y); printf("%d %d\n",x,y); } int swap2(int a, int b) { int temp; temp=a; b=a; a=temp; return 0; } The correct answer is 10, 5 5, 10
2007-02-26, 6775👍, 0💬

What Is the Quickest Sorting Method?
What is the quickest sorting method to use? The answer depends on what you mean by quickest. For most sorting problems, it just doesn't matter how quick the sort is because it is done infrequently or other operations take significantly more time anyway. Even in cases in which sorting speed is of the...
2007-02-26, 6768👍, 0💬

Pointer to Constants
What is the difference between const char* p and char const* p? In const char* p, the character pointed by "p" is constant, so you can not change the value of character pointed by p but u can make "p" refer to some other location. In char const* p, the pointer "p" is constant not the character refer...
2007-02-26, 6747👍, 0💬

Conditional Statements
What will be printed as the result of the operation below: main() { int a=0; if (a==0) printf("Cisco Systems\n"); printf("Cisco Systems\n"); } Answer: Two lines with "Cisco Systems" will be printed.
2007-02-26, 6741👍, 0💬

< 1 2 3 4 5 6 7 > >>   Sort: Date