Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printing quotes using printf

Status
Not open for further replies.

IMAUser

Technical User
May 28, 2003
121
CH
How can a print quotes using printf.

printf ( "%s , %s, %s ", &aa , &bb, &cc );

I need the o/p to read

'Firstcol','Secondcol','Third Column'
 
Any of the following would do.

\"
"" - Not ANSII compliant but widely supported.
%c

printf ("Hello \"World\"\n");
printf("Hello ""World\"\n");
printf("%c%s%c\n",'"',"Hello World",'"');
 
cross-posted to other languages as well...thread271-667797

"" - Not ANSII compliant but widely supported.
Means something entirely different in ANSI-C anyway
Ajacent string literals are combined by the compiler, so your "hello ""world" would be the same as "hello world".

Which compilers support this - because I've never seen any which support it. But then I've always used "\"" to print a double quote.

--
 
printf ( "'%s' , '%s', '%s' ", &aa , &bb, &cc );
or
printf ( "\'%s\' , \'%s\', \'%s\' ", &aa , &bb, &cc );

Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top