What is the o/p of the following C-program?Main(){Char str[7]="strings";Printf("%s",str);}

This question is related to Oracle Interview

Showing Answers 1 - 12 of 12 Answers


  • Aug 4th, 2005


  Was this answer useful?  Yes


  • Nov 29th, 2005

Index overflow due to inability of accomodation of '\0' character


  • Jun 30th, 2006

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"

  Was this answer useful?  Yes


  • Aug 14th, 2006

Wht about the syntax errors guys ???

  Was this answer useful?  Yes


  • Aug 24th, 2006

ans:  cannot be determind.

But i case tc++ compiler it print                           strings@     

where @ is the special character. 

  Was this answer useful?  Yes


  • Jan 5th, 2007


  Was this answer useful?  Yes


  • Sep 20th, 2014

but when str[6]="string"; //6 characters
it printed string and not any absurd value....
then why only in case of str[7]="strings";//7 characters
it prints absurd value at the end???

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions