On Fri, 6 Jun 2008 04:45:05 +0200 (CEST), John J. Smith
<jj*@localhost.invalidwrote:
>Thompson Reed wrote:
>Can someone give me an example C program with at least 20 lines of
source code.
Sure.
>That is the requirement and a line of code is a semicolon
according to the rules.
$ grep ';' sample.c | wc -l
C:\clcgrep ';' sample.c | wc -l
'grep' is not recognized as an internal or external command,
operable program or batch file.
[snip OP's drivel]
>(As an exercise, write a C program that can generate the
program below... many interviewers are very impressed by that)
Count me out as an interviewer who is not impressed by the generated
program.
[snip program]
Compiling...
sample.c
sample.c(13) : warning C4127: conditional expression is constant
sample.c(14) : warning C4127: conditional expression is constant
sample.c(15) : warning C4127: conditional expression is constant
sample.c(16) : warning C4127: conditional expression is constant
sample.c(17) : warning C4127: conditional expression is constant
sample.c(18) : warning C4127: conditional expression is constant
sample.c(19) : warning C4127: conditional expression is constant
sample.c(20) : warning C4127: conditional expression is constant
sample.c(21) : warning C4127: conditional expression is constant
sample.c(22) : warning C4127: conditional expression is constant
sample.c(23) : warning C4127: conditional expression is constant
sample.c(24) : warning C4127: conditional expression is constant
sample.c(25) : warning C4127: conditional expression is constant
sample.c(26) : warning C4127: conditional expression is constant
sample.c(27) : warning C4127: conditional expression is constant
sample.c(28) : warning C4127: conditional expression is constant
sample.c(29) : warning C4127: conditional expression is constant
sample.c(30) : warning C4127: conditional expression is constant
sample.c(31) : warning C4127: conditional expression is constant
sample.c(32) : warning C4127: conditional expression is constant
sample.c(33) : warning C4127: conditional expression is constant
sample.c(34) : warning C4127: conditional expression is constant
sample.c(35) : warning C4127: conditional expression is constant
sample.c(36) : warning C4127: conditional expression is constant
sample.c(37) : warning C4127: conditional expression is constant
sample.c(38) : warning C4127: conditional expression is constant
sample.c(39) : warning C4127: conditional expression is constant
sample.c(40) : warning C4127: conditional expression is constant
sample.c(41) : warning C4127: conditional expression is constant
sample.c(42) : warning C4127: conditional expression is constant
sample.c(43) : warning C4127: conditional expression is constant
sample.c(44) : warning C4127: conditional expression is constant
sample.c(45) : warning C4127: conditional expression is constant
sample.c(46) : warning C4127: conditional expression is constant
sample.c(47) : warning C4127: conditional expression is constant
sample.c(48) : warning C4127: conditional expression is constant
sample.c(49) : warning C4127: conditional expression is constant
sample.c(50) : warning C4127: conditional expression is constant
sample.c(51) : warning C4127: conditional expression is constant
sample.c(52) : warning C4127: conditional expression is constant
sample.c(53) : warning C4127: conditional expression is constant
sample.c(54) : warning C4127: conditional expression is constant
sample.c(55) : warning C4127: conditional expression is constant
sample.c(56) : warning C4127: conditional expression is constant
sample.c(57) : warning C4127: conditional expression is constant
sample.c(58) : warning C4127: conditional expression is constant
sample.c(59) : warning C4127: conditional expression is constant
sample.c(60) : warning C4127: conditional expression is constant
sample.c(61) : warning C4127: conditional expression is constant
sample.c(62) : warning C4127: conditional expression is constant
sample.c(101) : warning C4127: conditional expression is constant
sample.c(102) : warning C4127: conditional expression is constant
sample.c(103) : warning C4127: conditional expression is constant
sample.c(104) : warning C4127: conditional expression is constant
sample.obj - 0 error(s), 54 warning(s)
PC-lint for C/C++ (NT) Vers. 8.00u, Copyright Gimpel Software
1985-2006
--- Module: sample.c (C)
_
PRINTSIZE(char);
sample.c(13) : Info 717: do ... while(0);
_
PRINTSIZE(signed char);
sample.c(14) : Info 717: do ... while(0);
_
PRINTSIZE(char signed);
sample.c(15) : Info 717: do ... while(0);
_
PRINTSIZE(unsigned char);
sample.c(16) : Info 717: do ... while(0);
_
PRINTSIZE(char unsigned);
sample.c(17) : Info 717: do ... while(0);
_
PRINTSIZE(short);
sample.c(18) : Info 717: do ... while(0);
_
PRINTSIZE(signed short);
sample.c(19) : Info 717: do ... while(0);
_
PRINTSIZE(short signed);
sample.c(20) : Info 717: do ... while(0);
_
PRINTSIZE(short int);
sample.c(21) : Info 717: do ... while(0);
_
PRINTSIZE(int short);
sample.c(22) : Info 717: do ... while(0);
_
PRINTSIZE(signed short int);
sample.c(23) : Info 717: do ... while(0);
_
PRINTSIZE(signed int short);
sample.c(24) : Info 717: do ... while(0);
_
PRINTSIZE(short signed int);
sample.c(25) : Info 717: do ... while(0);
_
PRINTSIZE(short int signed);
sample.c(26) : Info 717: do ... while(0);
_
PRINTSIZE(int signed short);
sample.c(27) : Info 717: do ... while(0);
_
PRINTSIZE(int short signed);
sample.c(28) : Info 717: do ... while(0);
_
PRINTSIZE(unsigned short);
sample.c(29) : Info 717: do ... while(0);
_
PRINTSIZE(short unsigned);
sample.c(30) : Info 717: do ... while(0);
_
PRINTSIZE(unsigned short int);
sample.c(31) : Info 717: do ... while(0);
_
PRINTSIZE(unsigned int short);
sample.c(32) : Info 717: do ... while(0);
_
PRINTSIZE(short unsigned int);
sample.c(33) : Info 717: do ... while(0);
_
PRINTSIZE(short int unsigned);
sample.c(34) : Info 717: do ... while(0);
_
PRINTSIZE(int unsigned short);
sample.c(35) : Info 717: do ... while(0);
_
PRINTSIZE(int short unsigned);
sample.c(36) : Info 717: do ... while(0);
_
PRINTSIZE(int);
sample.c(37) : Info 717: do ... while(0);
_
PRINTSIZE(signed);
sample.c(38) : Info 717: do ... while(0);
_
PRINTSIZE(signed int);
sample.c(39) : Info 717: do ... while(0);
_
PRINTSIZE(int signed);
sample.c(40) : Info 717: do ... while(0);
_
PRINTSIZE(unsigned);
sample.c(41) : Info 717: do ... while(0);
_
PRINTSIZE(unsigned int);
sample.c(42) : Info 717: do ... while(0);
_
PRINTSIZE(int unsigned);
sample.c(43) : Info 717: do ... while(0);
_
PRINTSIZE(long);
sample.c(44) : Info 717: do ... while(0);
_
PRINTSIZE(signed long);
sample.c(45) : Info 717: do ... while(0);
_
PRINTSIZE(long signed);
sample.c(46) : Info 717: do ... while(0);
_
PRINTSIZE(long int);
sample.c(47) : Info 717: do ... while(0);
_
PRINTSIZE(int long);
sample.c(48) : Info 717: do ... while(0);
_
PRINTSIZE(signed long int);
sample.c(49) : Info 717: do ... while(0);
_
PRINTSIZE(signed int long);
sample.c(50) : Info 717: do ... while(0);
_
PRINTSIZE(long signed int);
sample.c(51) : Info 717: do ... while(0);
_
PRINTSIZE(long int signed);
sample.c(52) : Info 717: do ... while(0);
_
PRINTSIZE(int signed long);
sample.c(53) : Info 717: do ... while(0);
_
PRINTSIZE(int long signed);
sample.c(54) : Info 717: do ... while(0);
_
PRINTSIZE(unsigned long);
sample.c(55) : Info 717: do ... while(0);
_
PRINTSIZE(long unsigned);
sample.c(56) : Info 717: do ... while(0);
_
PRINTSIZE(unsigned long int);
sample.c(57) : Info 717: do ... while(0);
_
PRINTSIZE(unsigned int long);
sample.c(58) : Info 717: do ... while(0);
_
PRINTSIZE(long unsigned int);
sample.c(59) : Info 717: do ... while(0);
_
PRINTSIZE(long int unsigned);
sample.c(60) : Info 717: do ... while(0);
_
PRINTSIZE(int unsigned long);
sample.c(61) : Info 717: do ... while(0);
_
PRINTSIZE(int long unsigned);
sample.c(62) : Info 717: do ... while(0);
_
PRINTSIZE(long long);
sample.c(65) : Info 717: do ... while(0);
_
PRINTSIZE(signed long long);
sample.c(66) : Info 717: do ... while(0);
_
PRINTSIZE(long signed long);
sample.c(67) : Info 717: do ... while(0);
_
PRINTSIZE(long long signed);
sample.c(68) : Info 717: do ... while(0);
_
PRINTSIZE(long long int);
sample.c(69) : Info 717: do ... while(0);
_
PRINTSIZE(long int long);
sample.c(70) : Info 717: do ... while(0);
_
PRINTSIZE(int long long);
sample.c(71) : Info 717: do ... while(0);
_
PRINTSIZE(signed long long int);
sample.c(72) : Info 717: do ... while(0);
_
PRINTSIZE(signed long int long);
sample.c(73) : Info 717: do ... while(0);
_
PRINTSIZE(signed int long long);
sample.c(74) : Info 717: do ... while(0);
_
PRINTSIZE(long signed long int);
sample.c(75) : Info 717: do ... while(0);
_
PRINTSIZE(long signed int long);
sample.c(76) : Info 717: do ... while(0);
_
PRINTSIZE(long long signed int);
sample.c(77) : Info 717: do ... while(0);
_
PRINTSIZE(long long int signed);
sample.c(78) : Info 717: do ... while(0);
_
PRINTSIZE(long int signed long);
sample.c(79) : Info 717: do ... while(0);
_
PRINTSIZE(long int long signed);
sample.c(80) : Info 717: do ... while(0);
_
PRINTSIZE(int signed long long);
sample.c(81) : Info 717: do ... while(0);
_
PRINTSIZE(int long signed long);
sample.c(82) : Info 717: do ... while(0);
_
PRINTSIZE(int long long signed);
sample.c(83) : Info 717: do ... while(0);
_
PRINTSIZE(unsigned long long);
sample.c(84) : Info 717: do ... while(0);
_
PRINTSIZE(long unsigned long);
sample.c(85) : Info 717: do ... while(0);
_
PRINTSIZE(long long unsigned);
sample.c(86) : Info 717: do ... while(0);
_
PRINTSIZE(unsigned long long int);
sample.c(87) : Info 717: do ... while(0);
_
PRINTSIZE(unsigned long int long);
sample.c(88) : Info 717: do ... while(0);
_
PRINTSIZE(unsigned int long long);
sample.c(89) : Info 717: do ... while(0);
_
PRINTSIZE(long unsigned long int);
sample.c(90) : Info 717: do ... while(0);
_
PRINTSIZE(long unsigned int long);
sample.c(91) : Info 717: do ... while(0);
_
PRINTSIZE(long long unsigned int);
sample.c(92) : Info 717: do ... while(0);
_
PRINTSIZE(long long int unsigned);
sample.c(93) : Info 717: do ... while(0);
_
PRINTSIZE(long int unsigned long);
sample.c(94) : Info 717: do ... while(0);
_
PRINTSIZE(long int long unsigned);
sample.c(95) : Info 717: do ... while(0);
_
PRINTSIZE(int unsigned long long);
sample.c(96) : Info 717: do ... while(0);
_
PRINTSIZE(int long unsigned long);
sample.c(97) : Info 717: do ... while(0);
_
PRINTSIZE(int long long unsigned);
sample.c(98) : Info 717: do ... while(0);
_
PRINTSIZE(float);
sample.c(101) : Info 717: do ... while(0);
_
PRINTSIZE(double);
sample.c(102) : Info 717: do ... while(0);
_
PRINTSIZE(long double);
sample.c(103) : Info 717: do ... while(0);
_
PRINTSIZE(double long);
sample.c(104) : Info 717: do ... while(0);
_
PRINTSIZE(_Bool);
sample.c(107) : Info 717: do ... while(0);
--
jaysome