Advertisement

quick C question?

Started by May 09, 2002 05:32 PM
3 comments, last by gamefr 22 years, 7 months ago
I have been leaarning sdl through cone3d tuts, and I am wondering what the %(insert letter here) comands stand for? for example printf("Unable to set %dx%d video: &s\n",var,var,SDL_GetError()); thx for any help.
"Only to be a humble programmer is a goal I must achieve..."
They pull a value into the string...ex: %d would turn into whatever the first variable of that type in the arguments list.
%d is integer
%s is string
%c is a character
there are more but I dont have time to look them all up currently
hope that helps you.
Advertisement
It''s all in the documentation for printf and its format string. They are typed placeholders for the subsequent arguments.



[Questions (STFW) | GDNet Start Here | GDNet Search | Forum FAQ | Google | Asking Smart Questions ]
[Docs (RTFM) | MSDN | SGI''s STL | OpenGL | File formats]
[C++ Must Haves (RTFS) | MinGW | Boost | Loki | FLTK | SDL ]

Stolen from Magmai Kai Holmlor, who held it from Oluseyi, who was inspired by Kylotan...
"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
thx guys, now I understand the source better
"Only to be a humble programmer is a goal I must achieve..."
just to elaborate a bit i believe they are called digraphs as well.

This topic is closed to new replies.

Advertisement