Right now I am getting an unhandled exception access violation. I am needing the character to move in this way because I will be implementing an attack animation whenever space bar is pressed in a similar manner.

I attempted a trouble shoot and I would find out when the unhandled exception happens, but I don't understand how to fix it haha.

It currently prints the character facing all four directions then breaks. I will also be needing to get keyboard input for this. I will be having it move up with w, right - d, left - a, down - s. If I put in the key commands will it keep from breaking since it will only animate one thing at a time instead of everything?

Eh... I guess I will have to deal with poor performance. This is indtroductory programming course where we learn C. We have to make a game for final project using graphics.h library as this is all we have been shown and worked with so far. DirectX sounds like quite a complicated library where you REALLY have to know all the ins and outs of the programming language to utilize... I am not quite there haha.

If you're using graphics.h then I suspect you are using Turbo C. That compiler can not use either of the libraries I mentioned because it's too old amd obsolete. I don't know how to help you because it's only been 30 years since I used that compiler.

Oh I am using visual studio 2012. We were never really supposed to learn graphics, but the whole class wanted to so since we had never programmed before our teacher only showed us graphics.h since we wouldn't be able to handle other libraries at this point and has us make a game using graphics.h.

I am also confused on where to place my keyboard inputs. I want to use wasd movement for this game, but don't know where to check for keyboard hit. I wonder if that will solve unhandled exception? Since right now it just loops through and redraws character facing all directions. If I put keyboard hit it would ONLY draw one image at a time instead of all of them.

That compiler doesn't know how to use graphics.h, unless you found a 3d party library that implemented it for 32-bit and/or 64-bit MS-Windows os. graphics.h was used in the 1980s by Turbo C for MS-DOS 16-bit operating system. Pretty nice in it's day, but not useful today.

Of course, you might be talking about a completely different graphics.h. If so, where did it come from because it's not part of VC++ installation.

Well my professor created a rather advanced calculator for class use that we have been writing our own programs in and the calculator runs them (like games and what not). He implemented graphics.h into this program and we use it. He wrote a header file, and put graphics.h into the header file, and now we write programs in the header file.

But graphics.h working or not is not the issue here as it does indeed work. My problem is with my code above and implementing key hits to actually move the character.

Your professor wrote his/her own version of graphics.h (and associaged library). It's not the same one that is commonly used by Turbo C. Too bad he named it graphics.h because its confusing with Turbo C's graphics.h which most if not all older programmers are familiar with.

Does your professor's graphics.h contain non-standard keyboard handling functions? such as those found in conio.h, which is also non-standard? The standard C keyboard functions can't do what you have in mind because you always have to press <Enter> key afterwards. Better to use getch() from conio.h because it doesn't have that problem. getch() returns immediately, 0 or 224 if a special key was hit such as Function keys, one of the arrow keys, home, end, PgUp, PgDown. When that happens you just call getch() a second time to find out which of those keys was hit.

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...