Forum: C Nov 14th, 2008 |
| Replies: 11 Views: 1,438 I would advice threadstarter to read post #2, #3 and #5. The rest are either incorrect or referred to another question.
To adrianapatty_28, please start another thread if you have a totally... |
Forum: C Nov 9th, 2008 |
| Replies: 2 Views: 465 Some C compiler will give you a warning when your main function does not return an integer.
In this case, do the following changes to the main function:
int main()
{
......
......
return... |
Forum: C Nov 6th, 2008 |
| Replies: 11 Views: 1,438 Apart from initializing "i" to zero in all your for loops, your final display statement should be:
printf("%d occurs %d times\n", i, counters[i]); |
Forum: C Nov 6th, 2008 |
| Replies: 1 Views: 310 Seeing you have made some efforts in coding it yourself, I will take the trouble to go through your long post.
Here are the problems:
1. Initialize all your marks and counters when you declare... |
Forum: C Nov 6th, 2008 |
| Replies: 3 Views: 451 Just a simple example of calling a function:
get_start_balance();
To call a function, you just need to use the function name, and pass whatever parameters needed (in the above case the... |
Forum: C Oct 24th, 2008 |
| Replies: 8 Views: 2,085 Read my statement again. I said "TO ME, putting function declarations inside main is just like a potential time-bomb, even if at this moment your functions do not call each other". Its a PERCEPTION.... |
Forum: C Oct 24th, 2008 |
| Replies: 8 Views: 2,085 It's up to individual's interpretation of what constitutes to a potential time-bomb. To a novice programmer, if he makes a habit of declaring functions inside main function because all the functions... |
Forum: C Oct 24th, 2008 |
| Replies: 8 Views: 2,085 I don't know about others but to me putting function declarations inside main is just like a potential time-bomb, even if at this moment your functions do not call each other. |
Forum: C Oct 23rd, 2008 |
| Replies: 3 Views: 1,193 Go google "print hello world without semicolon". But its non Ansi C standard because it requires void main().
I am curious why you need to do these silly questions. If this is your assignment,... |
Forum: C Oct 23rd, 2008 |
| Replies: 3 Views: 670 int i = 1;
STUPID_ASSIGNMENT:
printf("%d\n", i);
if(i < 100)
{
i++;
goto STUPID_ASSIGNMENT;
} |
Forum: C Oct 16th, 2008 |
| Replies: 3 Views: 448 You can use CreateMutex() to create a named mutex. Then use WaitForSingleObject() to wait for the mutex, either for a fixed timing or infinitely. Then call ReleaseMutex() to release it. |
Forum: C Oct 16th, 2008 |
| Replies: 3 Views: 448 You can use CCriticalSection object if you are using MFC. They are less expensive than mutex.
Else, you can use InitializeCriticalSection(), EnterCriticalSection() and LeaveCriticalSection() for... |
Forum: C Oct 13th, 2008 |
| Replies: 2 Views: 422 Local variables are stored in the call stack, together with the return address and passing parameters.
Instructions are stored in the code segment, which is usually at the lower part of the memory... |
Forum: C Oct 12th, 2008 |
| Replies: 2 Views: 320 Your swap function is entirely wrong. You need to pass pointers to integers as the parameters, and do the swapping by writing to where the pointer points to. |
Forum: C Oct 10th, 2008 |
| Replies: 7 Views: 783 First parameter is wrong. Use char* instead of char. Are you going to change the value of those variables inside the function? If so, pass pointers or reference, else you can simply pass by values. |
Forum: C Oct 8th, 2008 |
| Replies: 6 Views: 615 What language you use? What's your level of proficiency? And how much time you have? |
Forum: C Oct 8th, 2008 |
| Replies: 5 Views: 640 Or you prefer everything to be inside one super big library? In that case, your hello world program could become hundreds of megabyte in size because every single program has to link to that one and... |
Forum: C Oct 7th, 2008 |
| Replies: 3 Views: 3,804 You can download GLUT from the net. Use google to search.
As for OpenGL files, they normally come with most C++ compilers/IDE. |
Forum: C Oct 5th, 2008 |
| Replies: 9 Views: 892 I see....I intuitively think of simulation whenever I saw the flipping of coins or rolling of dice. |
Forum: C Oct 5th, 2008 |
| Replies: 9 Views: 892 My understanding of the question is that it is simulating the flipping of a coin, which is 50% head and 50% tail. |
Forum: C Oct 4th, 2008 |
| Replies: 9 Views: 892 Is it part of the requirements to use recursive function? This program can be done easily without recursive function. Just use a loop is enough.
Also, check out rand() function to generate random... |
Forum: C Oct 3rd, 2008 |
| Replies: 3 Views: 639 I need the source code for controlling rockets. Can anybody send me? :) |
Forum: C Oct 3rd, 2008 |
| Replies: 8 Views: 2,121 When you are using the printf function:
printf("%s", a);
The function is treating variable "a" as a pointer to the beginning of a stream of characters. However, it doesn't have the... |
Forum: C Sep 26th, 2008 |
| Replies: 3 Views: 409 Please list down the errors you got so that we can help to analyze which parts go wrong. |
Forum: C Sep 26th, 2008 |
| Replies: 8 Views: 844 Tell you guys a joke. I know a friend who gave the below answer to a similar programming assignment:
printf("*\n");
printf("***\n");
printf("*****\n");
printf("*******\n");... |