As for the rest, it is implemented in C++
Type: Posts; User: mnml
As for the rest, it is implemented in C++
Thanks a lot for all your replies by the way.
I think I figured it out. All I had to do was increase the array's size by one.
I'm entering 3 chars to prev_move uppercase lowercase and a number, for example Pa2 and a2 to next_move.
I can't believe I'm struggling with this 2 hours now. I've tried several methods with no luck.
Do you mean I should not have a whitespace between " and % inside scanf ?
Is there any way to clear the buffer before the second scanf ?
I don't want to change the arrays size because I use them somewhere else in my program
Here's a good doubly linked list implementation: http://www.snippets.24bytes.com/2010/06/double-linked-list.html
tin askisi 2 kaneis? :)
I can't for the love of god understand why scanf doesnt work.
here's the code:
void main ()
{
char prev_move[3], next_move[2], new_move;
printf("Press 'y' for a new move or...
Thanks for your reply and explanation.
Do you mean that I should return a pointer to pointer inside allocate_memory() function?
How do I implement that?
all my code:
#include <stdio.h>...
Duh, right. I was allocating the memory in a function like that.
void allocate_memory(char **game)
{
//char **game;
game = (char**)malloc(8 * sizeof(char*));
int i;
for(i...
Can you explain this a bit more? check the return value of malloc?
Thats my code, at least thats where I'm stuck with my exercise.
this:
game[0][0] = 'r';
game[0][1] = 'b';
game[0][2]...
I'm allocating memory for a 8X8 char array:
char **game;
game = (char**)malloc(8 * sizeof(char*));
for(i = 0; i < 8; i++)
game[i] = (char*)malloc(8 * sizeof(char));
then try to...
Thanks
this is my complete do while condition
char menu;
do {
printf("MAIN MENU\n");
With scanf() I need to press a character, Enter, and then another character which is the option from the menu to run the switch statement.
Well actually It prints once and then runs the default case and prints again.
hello all
In a do while I'm printing a menu, getting a character from the keyboard and run a switch statement in the cases where that character is "d, v or f". the condition executes until the...