- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
7 Posted Topics
rewrite your evenOdd() function [code=c] void evenOdd(int *ptr){ int arr[N], i; int j; /*for keeping track of the index for arr*/ int*tmp; j=0; tmp=ptr; for(i = 0; i < N; ++i, tmp++){ if (*tmp %2==0) { arr[j]=*tmp; j++; } } tmp=ptr; for(i = 0; i < N; ++i, tmp++){ if …
I presume your functions arte wanting a pointer argument try prefixing your array argument with &
You can try using this to get a line from a file, and strip leading and trailing blanks, CR's etc and detect the EOF condition RETURNS: TRUE if EOF or file error has occurred FALSE if not EOF Note: typedef char * PSZ #define MAX_LINE_LEN to whatever value you like …
[code=c] #include <math.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <sys/time.h> #define MAX_NUM 40 #define NUM_LOTTO_BALLS 6 #define NUM_POWER_BALLS 8 void Rsleep( float period ) { int seconds, useconds; double TimeNow; struct timeval tvCurrent; seconds = itrunc(period); useconds = (period - seconds) * 1000000; gettimeofday(&tvCurrent, NULL); TimeNow = tvCurrent.tv_sec + …
Hi from New Zealand. I have been programming in C for the last 19 years. My true love is OO which I studied at university, but I have ended up in a C job (where the most annoying bugs are possible) with UNIX shell scripting and a proprietory ASM language …
there is some compilation problems when moving a car. But that is simply typos. e.g carstpr should be carsptr You should not start at the beginning of the list on every iteration should you?. I did this. [code=c] /*--move a car if it is in the same spot as another--*/ …
Several problems here fgets() returns the line feed character into its argument, so you must overwrite it if you want to compare you should use strstr() and not strcmp() since you are comparing whole lines read from your files here is a working solution [code=c] #include <stdio.h> #include <string.h> int …
The End.
IVR_Developer