Do something like this to open a file.
FILE *ptr_file;
ptr_file = fopen("output.txt", "r"); //open file to read
if (!ptr_file)
{
Type: Posts; User: rmatze
Do something like this to open a file.
FILE *ptr_file;
ptr_file = fopen("output.txt", "r"); //open file to read
if (!ptr_file)
{
I'm not familiar with that compiler.
I compiled this on VS and it works OK, see if it works for you.
void print(char *foo, char *bar)
{
printf("%s %s\n", foo, bar);
}
Change your printLCD to
void printLCD(char* s_line1, char* s_line2)
and it should work fine.
You need to increment begin, right now it's always 0.
Test it and find out.
Then you are going to have to print each spot in the correct order, it's not that bad. Since you can't use an array you are going to need a variable for each spot (9 total). I would probably use...
Instead of this:
int topRow, midRow, bottomRow;
int lCol, midCol, rCol;
int lDiag, rDiag;
do this
Try checking the value of the variables before the line that is giving you troubles. Something like this:
printf("MAX_CHILDREN: %d, children_served: %d, APPLES_PER_CHILD: %ld\n", MAX_CHILDREN,...
I ran this and it prints out correctly. Do you have some other code in there that might giving you problems?
#define MAX_CHILDREN 200
#define APPLES_PER_CHILD 25
int main(void)
{
long...
Wow, must have really had it out for that person.
That could get weird if I had split personalities and one personality was helping the other code. :)
I wish...far from it. ha
The OP pretty much has everything that i posted. I don't want to give everything for that very reason. Also, what is wrong with what I posted...it worked with no errors for me.
We all had to learn just like you. I think you should stay away from recursion. Just use a do while loop instead of the for loop.
do
{
//call your fib function and save the...
Nope, this is all you need:
int fib(int fib1, int fib2)
{
return fib1 + fib2;
}
If you want to have a random num 1-10 do something like this:
ran_num = rand() % 10 + 1;
Then change the 10 to the max num you want to use.
Set ran_num = rand();
Then do something like this:
if (ran_num % 2 == 0)
{
printf("%i\n", ran_num);
eve_num++;
True, now that I've looked at it more, a simple do while loop will work just fine.
You are making this more difficult then it has to be.
You are going to want to start with fib1 = 0 and fib2 = 1. Then create a loop. Call the fib function which all you want it to do is add two...
Have you learned recursion? It would make this program a lot easier and cleaner.
Get rid of the quotes around the file name variable every time you try to open a file. It is trying to open file rFileName not what's stored in that variable.
pRead = fopen(rFileName, "r");
Do you have to save the numbers into the array. Just expand your for loop the go around your if statements and every time you use arr[] replace it with ran_num.
When passing a multidimensional array in this manner, only the first dimension can be omitted.
Try:
void initial_board (char board[][BOARD_SIZE], int board_size)
Also you don't have to...
Repost your updated code.
Also, you need to call the functions from main. They can't execute if you don't call them.
And increment i in your while loop