9 Apr 2017

How to Suppress a character using Scanf

If we want to skip any input then we specify ' * ' between % sign and converstion specifier.The input is read but it is not assign to any address,so this is called as
Suppression of character.

for example: scanf("%d %*d %d",&a,&b,&c);

Input format:
a=25,b=15,c=30

here,25 is stored into a variable, 15 is skipped and 30 is stored into b variable, and c is stored with garbage.

output format
a=25,b=30,c=garbage

1 comment:

  1. whats the use of applying supression character here.

    ReplyDelete

commnet here