Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Bleedthrough

Printing an "int" to the screen

This topic is 5237 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anybody know how to print an "int" to the screen? For example, I tried: int temp = 12; printf(temp); and it gave me this error: error C2664: ''printf'' : cannot convert parameter 1 from ''int'' to ''const char *'' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast Error executing cl.exe.

Share this post


Link to post
Share on other sites
Advertisement
C: printf("%d", temp);

C++: std::cout << temp;


“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”
— Brian W. Kernighan (C programming language co-inventor)


[edited by - Fruny on February 19, 2004 4:58:43 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!