Hi Guys. Another quick question for you. I have just come across the %i place holder but i don't understand the difference between %i and %d. The section in my book that lists all the place holders says there both int place holders. In the program i am looking at it don't explain why the %i is used instead of %d. It's the first time i have come across the %i place holder. Sorry if it's a dumb question but i need to know everything
This example makes you more understand... Code: #include <stdio.h> int main() { char InStr[] = "150 0125"; int val1=0, val2=0; //******* Reading integer values*****/// sscanf(InStr, "%i %i ", &val1, &val2); //**************************************** printf("The Decimal values are : %d %d\n", val1,val2); val1=0; val2=0; //******* Reading Decimal integer values*****/// sscanf(InStr, "%d %d", &val1, &val2); //**************************************** printf("The Decimal values are : %d %d\n", val1,val2); return 0; } Output:: asadulla ~/temp> gcc test1.cc execution gcc-3.3.1 asadulla ~/temp> ./a.out The Decimal values are : 150 85 The Decimal values are : 150 125