String

Status
Not open for further replies.

Mohan Giri

In Runtime
Messages
144
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?
 
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.
 
Status
Not open for further replies.
Back
Top Bottom