Forum: C Oct 28th, 2008 |
| Replies: 22 Views: 1,832 Wash your mouth out with soap. main() returns int. |
Forum: C Oct 28th, 2008 |
| Replies: 22 Views: 1,832 I'll answer your question with a question.
Under what conditions will
if ((x < 1 || x > 4) && printf("Goofy"))
{
printf(" is also known as Dippy Dawg");
}
print out "Goofy is also... |
Forum: C Oct 27th, 2008 |
| Replies: 22 Views: 1,832 A post-test loop is a generic name for a loop of the form do { ... } while (condition), as opposed to a while(condition) {} loop.
The solution, if you have to do that, is to have the printf()... |
Forum: C Oct 27th, 2008 |
| Replies: 6 Views: 815 (1) strtok() assumes both its arguments are strings that are terminated with a 0 character. Behaviour is undefined if that is not true.
2) strtok also returns NULL if it cannot find a token... |
Forum: C Oct 18th, 2008 |
| Replies: 24 Views: 8,110 Not even close.
Your code does not insert any characters into the string array. What is the purpose of the "input" argument supplied to the function? where is the codes counting the number of... |
Forum: C Oct 18th, 2008 |
| Replies: 6 Views: 779 scanf() would return an EOF in that case.[/QUOTE]
No it will not. It will return zero in that case.
EOF is only returned upon reaching end of input. If there is input in the stream that does... |
Forum: C Oct 14th, 2008 |
| Replies: 10 Views: 860 Yes. Look up the C standard header stdarg.h or (in C++) the standard header <cstdarg>. Those headers contain macros and types that support writing functions with variable argument lists. |
Forum: C Oct 12th, 2008 |
| Replies: 4 Views: 915 Apart from that, it often takes a lot more effort to write assembly code to achieve X than it does to do X in a higher level language like C. C also has a library .... which means it is not... |
Forum: C Oct 4th, 2008 |
| Replies: 6 Views: 953 There is also the incidental concern that your function is recursive, which does not meet the requirement to be non-recursive. |
Forum: C Oct 4th, 2008 |
| Replies: 8 Views: 2,046 A c-style string (eg a string literal) is an array of char that, by convention, is terminated with '\0'. |
Forum: C Oct 3rd, 2008 |
| Replies: 8 Views: 2,046 Because the %s format specifier tells printf() and related function that the corresponding argument is a pointer to char and to keep printing chars until it finds a zero.
When an array is passed... |
Forum: C Oct 1st, 2008 |
| Replies: 8 Views: 2,046 That's not true. You have explicitly initialised two elements of three-element array. The standards go about it in a round-about way (there's a logic train to follow to get to the conclusion, and... |
Forum: C Sep 11th, 2008 |
| Replies: 4 Views: 464 Firstly, your variables a, b, and c are uninitialised: their value before entering the loop could be anything.
As to your loop, it doesn't really make sense.
You only need two variables. An... |