Jump to content
  • Advertisement


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


Printing an "int" to the screen

This topic is 5412 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
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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!