Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 04-23-2005, 03:08 PM   #1 (permalink)
 
True Techie

Join Date: Dec 2004

Posts: 145

Mohan Giri

Default String

If we assign a string more than its size what will be the result? Will it print the entire string or give any warning message or will it give any error message?
Mohan Giri is offline  
Old 04-24-2005, 12:36 AM   #2 (permalink)
 
Monster Techie

Join Date: May 2004

Location: /usr/root/mn/us

Posts: 1,121

bla!! is on a distinguished road

Default

If you don't guard against overflow, it will do one of two things:

Print the entire string up to the length of the specified buffer, or it will cause a segmentation fault because it overwrote the return pointer from the function.

This is assiuming you're using a printf call.
__________________
<br>
Its a frigging Laptop, not a Labtop!!!!
bla!! is offline  
Old 05-03-2005, 05:39 PM   #3 (permalink)
 
Ultra Techie

Join Date: Apr 2005

Posts: 950

M4A1 is on a distinguished road

Send a message via AIM to M4A1
Default

These questions sound like homework problems.
M4A1 is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On