<< < 9 10 11 12 13 14 15 16 17 > >>   Sort: Rank

There seem to be a few missing operators ..
There seem to be a few missing operators, like ^^, &amp;&amp;=, and -&gt;=. A:A logical exclusive-or operator (hypothetically ``^^'') would be nice, but it couldn't possibly have short-circuiting behavior analogous to &amp;&amp; and || Similarly, it's not clear how short-circuiti...
2015-01-28, 1234👍, 0💬

Does C have circular shift operators?
Does C have circular shift operators? No. (Part of the reason why is that the sizes of C's types aren't precisely defined----but a circular shift makes most sense when applied to a word of a particular known size.) You can implement a circular shift using two regular shifts and a bitwise OR: (x &...
2015-01-28, 1276👍, 0💬

Is C a great language, or what?
Is C a great language, or what? Where else could you write something like a+++++b ? A: Well, you can't meaningfully write it in C, either. The rule for lexical analysis is that at each point during a straightforward left-to-right scan, the longest possible token is determined, without regard to whet...
2015-01-26, 1301👍, 0💬

If the assignment operator were ...
If the assignment operator were :=, wouldn't it then be harder to accidentally write things like if(a = b) ? A: Yes, but it would also be just a little bit more cumbersome to type all of the assignment statements which a typical program contains. In any case, it's really too late to be worrying abou...
2015-01-26, 1270👍, 0💬

Does C have an equivalent to Pascals with statement?
Does C have an equivalent to Pascals with statement? No. The way in C to get quick and easy access to the fields of a structure is to declare a little local structure pointer variable (which, it must be admitted, is not quite as notationally convenient as a with statement and doesn't save quite as m...
2015-01-14, 1294👍, 0💬

Why doesnt C have nested functions?
Why doesnt C have nested functions? It's not trivial to implement nested functions such that they have the proper access to local variables in the containing function(s), so they were deliberately left out of C as a simplification. (gcc does allow them, as an extension.) For many potential uses of n...
2015-01-14, 1353👍, 0💬

What is assert and when would I use it?
What is assert and when would I use it? It is a macro, defined in &lt;assert.h>, for testing ``assertions''. An assertion essentially documents an assumption being made by the programmer, an assumption which, if violated, would indicate a serious programming error. For example, a function which ...
2015-01-12, 1312👍, 0💬

How can I call FORTRAN?
How can I call FORTRAN? Q: How can I call FORTRAN (C++, BASIC, Pascal, Ada, LISP) functions from C? (And vice versa?) A: The answer is entirely dependent on the machine and the specific calling sequences of the various compilers in use, and may not be possible at all. Read your compiler documentatio...
2015-01-12, 1313👍, 0💬

What are the differences between C and CPP?
What are the differences between C and CPP? Q: Is C++ a superset of C? What are the differences between C and C++? Can I use a C++ compiler to compile C code? A: C++ was derived from C, and is largely based on it, but there are some legal C constructs which are not legal C++. Conversely, ANSI C inhe...
2015-01-10, 1194👍, 0💬

I need a sort of an approximate strcmp routine ...
I need a sort of an approximate strcmp routine ... Q: I need a sort of an ``approximate'' strcmp routine, for comparing two strings for close, but not necessarily exact, equality. A:Some nice information and algorithms having to do with approximate string matching, as well as a useful bibliography, ...
2015-01-09, 1284👍, 0💬

What is hashing?
What is hashing? Hashing is the process of mapping strings to integers, usually in a relatively small range. A ``hash function'' maps a string (or some other data structure) to a bounded number (the ``hash bucket'') which can more easily be used as an index in an array, or for performing repeated co...
2015-01-07, 1316👍, 0💬

How can I find the day of the week given the date?
How can I find the day of the week given the date? Here are three methods: 1. Use mktime or localtime # . Here is a code fragment which computes the day of the week for February 29, 2000: #include &lt;stdio.h> #include &lt;time.h> char *wday[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "...
2015-01-07, 1239👍, 0💬

Was 2000 a leap year?
Was 2000 a leap year? Q: Is (year % 4 == 0) an accurate test for leap years? (Was 2000 a leap year?) A: No, it's not accurate (and yes, 2000 was a leap year). The actual rules for the present Gregorian calendar are that leap years occur every four years, but not every 100 years, except that they do ...
2015-01-05, 1288👍, 0💬

Suggesting that there can be 62 seconds in a minute?
Suggesting that there can be 62 seconds in a minute? Q: Why can tm_sec in the tm structure range from 0 to 61, suggesting that there can be 62 seconds in a minute? A: That's actually a buglet in the Standard. There can be 61 seconds in a minute during a leap second. It's possible for there to be two...
2015-01-05, 1353👍, 0💬

Here is a good puzzle: how do you write a program which produces its own source code as output?
Here is a good puzzle: how do you write a program which produces its own source code as output? It is actually quite difficult to write a self-reproducing program that is truly portable, due particularly to quoting and character set difficulties. Here is a classic example (which ought to be presente...
2015-01-02, 1384👍, 0💬

What is Duff's Device?
What is Duff's Device? It's a devastatingly devious way of unrolling a loop, devised by Tom Duff while he was at Lucasfilm. In its ``classic'' form, it was used to copy bytes, and looked like this: register n = (count + 7) / 8; /* count > 0 assumed */ switch (count % 8) { case 0: do { *to = *from++;...
2015-01-02, 1494👍, 0💬

What is C language?
What is C language? The C programming language is a standardized programming language developed in the early 1970s by Ken Thompson and Dennis Ritchie for use on the UNIX operating system. It has since spread to many other operating systems, and is one of the most widely used programming languages. C...
2014-12-31, 1399👍, 0💬

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

About listing of the process
how to write a .c program in unix ,like I want to list the process information when I give the process id.
2010-04-07, 4112👍, 0💬

C question
What is the difference between: myObj *x = new myObj[100]; delete x; and myObj *x = new myObj[100]; delete [] x;
2009-07-16, 5163👍, 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, 4612👍, 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, 6813👍, 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, 6860👍, 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 &amp; operator array as a string literal initializer for a character array Then ...
2007-02-26, 7343👍, 0💬

<< < 9 10 11 12 13 14 15 16 17 > >>   Sort: Rank