blackcell Posted January 25, 2008 Share Posted January 25, 2008 Hey I don't quite grasp the idea of using %d as in: scanf ( "%d", &units ); or in printf( "%d Units", unit); Also, does anybody have any good recommendations for sites like this covering C? Link to comment https://forums.phpfreaks.com/topic/87695-solved-c-question/ Share on other sites More sharing options...
trq Posted January 25, 2008 Share Posted January 25, 2008 Hey I don't quite grasp the idea of using %d as in: scanf ( "%d", &units ); or in printf( "%d Units", unit); Its exactly the same as in php. Take a look at sprintf. Also, does anybody have any good recommendations for sites like this covering C? You might try here. Link to comment https://forums.phpfreaks.com/topic/87695-solved-c-question/#findComment-448568 Share on other sites More sharing options...
blackcell Posted January 25, 2008 Author Share Posted January 25, 2008 Don't think I have ever used it in PHP and now my C college class brought it up and it threw me for a loop. Thanks for the info and site! Link to comment https://forums.phpfreaks.com/topic/87695-solved-c-question/#findComment-449061 Share on other sites More sharing options...
Andyf Posted February 18, 2008 Share Posted February 18, 2008 Do ref : acm.uiuc.edu/webmonkeys/book/c_guide/ for more on C programming it's very useful source for all about C language. Link to comment https://forums.phpfreaks.com/topic/87695-solved-c-question/#findComment-469654 Share on other sites More sharing options...
guyfromfl Posted March 27, 2008 Share Posted March 27, 2008 in the case of scanf("%d", &units); %d is saying to expect an integer. others are %f for float, double and %c for char but there are more in the case of printf("%d Units", unit); thats to say where you want the integer to be displayed take your phone number for example to print (XXX) XXX-XXXX, you can do that in one line of code: printf("(%d) %d-%d", areaCode, exchange, phNum); Link to comment https://forums.phpfreaks.com/topic/87695-solved-c-question/#findComment-502634 Share on other sites More sharing options...
blackcell Posted March 28, 2008 Author Share Posted March 28, 2008 Got it. Thanks. Link to comment https://forums.phpfreaks.com/topic/87695-solved-c-question/#findComment-503059 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.