I am using the following code to copy strings from one array to another. Upto 7 characters it copies fine but when the source string increases from 7 it starts giving '@' sign at the end of the output. can somone figure out the problem?
To Athar(2663)
n gets the value from source as, which means, that whatever is the length of source is, would be the value of n. so, nothing is wrong with n. and yes my code does compile and gives no error.
To andywestken(935)
no i am not using devC++
The only reason it compiles is because you actually do define the size of the arrays; but not in the way that you think. source[] is defined by actually putting in the variables, so it is exactly the length of the input that you put in to it. destination[n] with an undefined int n actually makes destination fixed at exactly the length that the compiler just happens to select (by selecting a probably already initialized memory address), and is not actually defined as a known parameter. So, while it compiles, you still don't get the result that you're looking for, and probably never will.