quick C question?
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.
%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.
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...
[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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement