Wednesday, September 4, 2013

Some C Facts

Scanf : In scanf all the operators are preceeded with the % sign because in scanf the argument presented by it are actually address. But the same does not apply to an array or string,why?
Because an array or string name is already an address of its first location , so no need to use % sign.

main( )
{char item[20];
int partno;
float cost;
scanf(" %s %d %f', item, &partno, &cost);
}

No comments:

Post a Comment