An online placement forum.

You are not connected. Please login or register

Code snippet meaning

Go down  Message [Page 1 of 1]

1 Code snippet meaning on Wed May 12, 2010 9:51 pm

Please explain the meaning of the following snippet.thanks in adv.

char name[10],s[12];
scanf(" \"%[^\"]\"",s);

View user profile

2 Re: Code snippet meaning on Thu May 13, 2010 5:29 pm

Uncommon thing -> use of a valid scanf converter i.e. [^\"].
[^ .....] matches the longest sequence of characters not having the characters defined within the brackets.

For ex -
char str[12];
scanf("%[^it]", str);

If the input is "Ankit" then str will have "Ank"....

View user profile

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum