Me and My Muse

Wednesday, August 30, 2006

Usage of assignment suppression operator in scanf ..

Suppose you have some crap input, then what normally we do is take a dummy variable and scan the input in that variable ..

for example if you have to scan a integar which is of no use .. then what you do is
int dummy


but there is one more method which can save memory and time

what you do is


In this method .. we provide a character * to the scanf function and by doing that .. scanf will scan the input from standard input .. but it wont assign it to any variable .. ( this is scanned in a buffer of sufficient size .. and you dont have to worry about that ) ..



Post a Comment

<< Home