Thanks I fixed the problem the reason I am using c instead of c++ is because my lecture is living in the dark ages (ones and zeros)
Printable View
Thanks I fixed the problem the reason I am using c instead of c++ is because my lecture is living in the dark ages (ones and zeros)
ah the joys of scanf how are you entering the data all in one line then note that scanf will read the entire line into you char array which only holds 10 characters and hence produce a buffer overflow overwriting anything in memory after that buffer is there any reason why you are using plain old C instead of C++Quote:
Originally Posted by Robbo99
When the problem lies with scanf, use strncpy. That way, you can specify just how much you would like to copy into the character array.
Robbo99 - Please don't delete your original question. Even though it was answered to your satisfaction, some of us (namely me) would like to know what the problem was...
Thanks!
Viggy