![]() Your code do not behave the way you expect, or you don't understand why ! Oddities are against your code, you are the only one able to tell because we can't run your code. ![]() Quote:Was it a problem with the compiler (DEV C++) or the code is faulty? I wrap them into a namespace or data structure called "global" just to make them obvious. It was very annoying so now I am very careful about using global variables. I have had to maintain a few programs now where numerous data variables were declared as global and I had to make lots of changes when I distributed the processing across multiple threads. It is also a much better way to deal with lots of variables that might be declared as global. ![]() For example, if you don't want to push so much data on the stack then wrap all the parameters into a structure and pass a pointer to the structure. If performance is an issue there are many ways to handle it. My general rule of thumb is if I see a sequence of code repeated three times (twice for longer sequences) then I seriously consider making it a function. Have you noticed how similar the code is for each key entry? That is an indication that you should make a function out of that sequence of code and pass the values that differ for each key to it which appear to be the x and y values. Maze = ( char *)malloc( sizeof( char)*N*N+sizeof( char)) The function that generates the maze (N is size): ![]() } while( *(lab+pointerpoint(ex, ey)) != *(lab+pointerpoint(sx, sy)) )
0 Comments
Leave a Reply. |