-
October 21st, 2004, 06:35 AM
#1
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)
Last edited by Robbo99; October 21st, 2004 at 06:51 AM.
-
October 21st, 2004, 06:43 AM
#2
Re: printing the contents of a pointer
Originally Posted by Robbo99
but instead it is giving me large numbers which I think are the pointer address but not the output here is the code I would love it if someone could show me how to fix it
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++
-
October 21st, 2004, 06:52 AM
#3
Re: printing the contents of a pointer
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.
-
October 21st, 2004, 11:48 AM
#4
Re: printing the contents of a pointer
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|