Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!unhd!rgd From: rgd@uunet!unhd (Roger G Desroches II) Newsgroups: comp.lang.c Subject: print format Message-ID: <1990Aug2.162651.8083@uunet!unhd> Date: 2 Aug 90 16:26:51 GMT Distribution: usa Organization: Computing Information Services, University of New Hampshire Lines: 21 Is there a way to specify the format in a print statement with a variable. What I want to do is print out a group of strings so they are all right justified on the right side with the largest string. (example) format = sizeof(largest_string); for (i=0;array[i];i++) printf("%[format]s\n",array[i]); ^^^^^^^^ this is what I want to do. I realize I can write a routine to do this, but I am going to be doing it quite a bit and would like to keep the CPU time down to a minimum. Does anyone have any ideas? Thank you. -- / | . . . . o o . . . . xxxxxxxxxxx|rgd@unhd.unh.edu######> | ^ ^ ^ ^ ^ \ | --- --- \_/ --- --- "Never let an inanimate object throw you" - me. | Never Follow