1 2 3 > >>   Sort: Rank

Regarding C Coding
Regarding C Coding Given: Line in file Contents 30 int * someIDs, theFirst, *r; 110 someIDs =GetSomeIDs(); /* defined below */ 111 theFirst = someIDs [0]; 112 r= ReorderIDs(someIDs); 113-150 /* we want to use ‘theFirst’ and ‘r’ here*/ 499 /*-------- GetSomeIDs-----*/ 500 int * GetSomeIDs() 501 { 50...
2010-05-12, 10485👍, 0💬

How can i trap the arrow keys inside the timer program?
How can i trap the arrow keys inside the timer program? How do you trap arrow keys in a regular program? What makes a timer program special?
2009-04-19, 4584👍, 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, 6758👍, 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, 6817👍, 0💬

Address of the First Element of an Array
When does the compiler not implicitly generate the address of the first element of an array? Whenever an array name appears in an expression such as: array as an operand of the sizeof operator array as an operand of & operator array as a string literal initializer for a character array Then ...
2007-02-26, 7304👍, 0💬

Modulation Operations
Write an equivalent expression for x%8? x&7
2007-02-26, 6855👍, 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, 6665👍, 0💬

"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, 7010👍, 0💬

Determining If Symbols Are Defined or Not
How can you check to see whether a symbol is defined? You can use the #ifdef and #ifndef preprocessor directives to check whether a symbol has been defined (#ifdef) or whether it has not been defined (#ifndef). Can you define which header file to include at compile time? Yes. This can be done by usi...
2007-02-26, 6366👍, 0💬

Overriding Defined Macros
How do you override a defined macro? You can use the #undef preprocessor directive to undefine (override) a previously defined macro.
2007-02-26, 6559👍, 0💬

Can Static Variables Be Declared in Header Files
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 inc...
2007-02-26, 8234👍, 0💬

Determing the Size of Allocated Memory Blocks
How can you determine the size of an allocated portion of memory? You can't, really. free() can , but there's no way for your program to know the trick free() uses. Even if you disassemble the library and discover the trick, there’s no guarantee the trick won’t change with the next release of the co...
2007-02-26, 6434👍, 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, 6621👍, 0💬

"register" Modifier
When should the register modifier be used? Does it really help? The register modifier hints to the compiler that the variable will be heavily used and should be kept in the CPU's registers, if possible, so that it can be accessed faster. There are several restrictions on the use of the register modi...
2007-02-26, 9256👍, 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, 6664👍, 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, 6608👍, 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, 6708👍, 0💬

Opening Files to Share with Other Programs
How can I open a file so that other programs can update it at the same time? Your C compiler library contains a low-level file function called sopen() that can be used to open a file in shared mode. Beginning with DOS 3.0, files could be opened in shared mode by loading a special program named SHARE...
2007-02-26, 6252👍, 0💬

enum vs. define Statements
What is the benefit of using an enum rather than a #define constant? The use of an enumeration constant (enum) has many advantages over using the traditional symbolic constant style of #define. These advantages include a lower maintenance requirement, improved program readability, and better debuggi...
2007-02-26, 10513👍, 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 < and >. This method of inclusion tells the preprocessor to look for the file in the predefine...
2007-02-26, 6862👍, 0💬

Swapping Variables
Can you write a program to interchange 2 variables without using the third one? a = 7; b = 2; a = a + b; b = a - b; a = a - b;
2007-02-26, 6263👍, 0💬

Calling Base Class Methods
How can method defined in multiple base classes with same name be invoked from derived class simultaneously? class x { public: m1(); }; class y { public: m1(); }; class z: public x, public y { public: m1() { x::m1(); y::m1(); } };
2007-02-26, 6386👍, 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, 6557👍, 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, 6859👍, 0💬

1 2 3 > >>   Sort: Rank