V
vamshi
main()
{
char str[20];
printf("Enter a string: ");
scanf("%[^a]",str);
printf("%[^a]",str);
}
Can some one help me with this code?
when i tried to execute this..... it reads the string untill character
' a ' and copies to str.
after 'a' everything else we type is discarded.
where can this be used? how exactly it is working?
is it making ^ operation on read data and when 'a' is pressed the ^
operation value turns out to be 0 which is string termination. is it
so? can i use other operators also instead of ^?
will it work on int and other data types?
whats the use of %[^a] in printf?
Thanks in advance....
Vamshi.
{
char str[20];
printf("Enter a string: ");
scanf("%[^a]",str);
printf("%[^a]",str);
}
Can some one help me with this code?
when i tried to execute this..... it reads the string untill character
' a ' and copies to str.
after 'a' everything else we type is discarded.
where can this be used? how exactly it is working?
is it making ^ operation on read data and when 'a' is pressed the ^
operation value turns out to be 0 which is string termination. is it
so? can i use other operators also instead of ^?
will it work on int and other data types?
whats the use of %[^a] in printf?
Thanks in advance....
Vamshi.