Ok someone new here, when you get code like
printf("%s")
not sure if that is how it goes but what/why does that
"%whatever" do??
Ok someone new here, when you get code like
printf("%s")
not sure if that is how it goes but what/why does that
"%whatever" do??
-Microsofts Visual C++ Introductory Kit-
Current Projects: Learning Everything C.
Everyone has a photographic memory, some people just don't have any film.
______________________________
When was the last time you went for a colon cleansing? Because quite frankly, you're so backed up with crap that it's spilling out your mouth
It's a special format string. %s means "Print a string".
printf("%s"); alone won't do much (will probably crash).
Look at this example for its use: (%d = integer)
Code:#include <stdio.h> #include <conio.h> int main() { char Name[] = "David"; int Age = 19; printf("Hello %s, are you %d years old?", Name, Age); getch(); return 0; }
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
Alright thanks Magos I will try that for a bit and something a bit off topic can anyone reccomend a good C book for reference that would have all of these simple questions answered somewhere in it?
-Microsofts Visual C++ Introductory Kit-
Current Projects: Learning Everything C.
Everyone has a photographic memory, some people just don't have any film.
______________________________
When was the last time you went for a colon cleansing? Because quite frankly, you're so backed up with crap that it's spilling out your mouth
No - but if you get the online help that comes with most big comercial compilers (even Borland's free downloads!), you can do searches, and it'll have good reference sections. With this for example, it explains the basics, and then it has a table of all the symbols to use in the format string. It's excellent.