Aptitude Question: Download Questions PDF
What is the o/p of the following C-program?
Main()
{
Char str[7]="strings";
Printf("%s",str);
}
Answer:
This problem doesnt cause any kind of error!!! this is really tricky.. the size of the string "strings" is 7 but it terminates with a char. thus causing the total size to 8.
here in this case some abserd value will come as an output..
if the size of the array is less than 7 then it ll give the error " too many initilization"
and if the size is more than7 then the output ll be perfect and "strings"
here in this case some abserd value will come as an output..
if the size of the array is less than 7 then it ll give the error " too many initilization"
and if the size is more than7 then the output ll be perfect and "strings"
Download Aptitude Interview Questions And Answers
PDF