main() { char dummy[20]; scanf("%[^a]",dummy); printf("%s", dummy); } What will it do? A. ERROR B. take characters till ctrl z is pressed C. take up to 19 characters D. none of these

This question is related to Wipro Interview

Showing Answers 1 - 7 of 7 Answers

sailakshmi

  • Feb 10th, 2006
 

ans:

         take characters till ctrlz is pessed

  Was this answer useful?  Yes

Sandeep

  • Sep 18th, 2011
 

it will print the characters till 'a' encounter..

If you will write scanf("%[^g]",dummy);
then
It will print all the characters till the 'g' encounter.

  Was this answer useful?  Yes

SAPAN KUMAR DAS

  • Oct 10th, 2011
 

the ans will be none of these.
because scanf("%[^a]",dummy); means it will store characters in dummy upto 1st a is encountered in the input

buffer stdin .

so it will show output to the string upto 1st 'a';

eg. if we will enter "hello sapan"
it will show :- hello s

  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