Hello
I want to move a character in a 2D array
This Character should move vertically in a 2D Array
To exemplify it for Exam in Snake Game A character automatically moves
Please Write a example code that works
Thanks A lot
Hello
I want to move a character in a 2D array
This Character should move vertically in a 2D Array
To exemplify it for Exam in Snake Game A character automatically moves
Please Write a example code that works
Thanks A lot
Please Help me Fast
(Sorry For spamming)
I suggest that you write a program that declares and populates a small 2D array, perhaps printing it. This will show us a skeleton of the program that you can start from, as well as show us a set of test input. Then, show us your expected output. From there, we can suggest how you can come up with a solution to write code that will arrive at your expected output.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Can you please Write An example For me?
Sure. Here's an example of what I described in post #3, with a 1D array of char:
I do not know what the expected output will be though, since it is unclear to me what exactly "move a character" means. Of course, when you follow my suggestions in post #3 for your 2D array, your example could help to explain what it means.Code:#include <stdio.h> #define N 10 int main(void) { char characters[N] = "abcdefghi"; printf("%s\n", characters); /* code to move a character */ /* ... */ printf("%s\n", characters); return 0; }
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)