Computing.Net > Forums > Programming > C Programming prob.

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

C Programming prob.

Reply to Message Icon

Name: Gigsnerb
Date: April 5, 2002 at 14:45:20 Pacific
Comment:

in C i understand that "%d" acts as a placeholder for a value but what does "%4d" mean. Any help appreciated.

Gigsnerb



Sponsored Link
Ads by Google

Response Number 1
Name: Mark
Date: April 5, 2002 at 17:40:03 Pacific
Reply:

the 4 designates how wide the field is to print the integer, for example:

printf("%c%c%c",'A','B','C');
gives: ABC

printf("%2c%3c%4c",'A','B','C');
gives: A B C


0

Response Number 2
Name: Mark
Date: April 5, 2002 at 17:41:34 Pacific
Reply:

formatting doesn't work well here but there should be 2 and 3 spaces between AB and BC respectively and a space before the A.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: C Programming prob.

c++ programming for novell www.computing.net/answers/programming/c-programming-for-novell/2525.html

Bike Trader C program www.computing.net/answers/programming/bike-trader-c-program/6557.html

C++ Programming Website www.computing.net/answers/programming/c-programming-website/4752.html