473,320 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Example Needed

Can someone give me an example C program with at least 20 lines of
source code. That is the requirement and a line of code is a semicolon
according to the rules. I have a job interview on Friday and they want
this the day before the interview. I am not a C expert like many of you
but I am a hard worker and I need this job. Please help a brother and
American patriot in need.

Thanks in advance -- Thompson R.
Jun 27 '08 #1
17 1301
On Jun 4, 8:45 am, Thompson Reed <treed1...@botsview.comwrote:
Can someone give me an example C program with at least 20 lines of
source code. That is the requirement and a line of code is a semicolon
according to the rules. I have a job interview on Friday and they want
this the day before the interview. I am not a C expert like many of you
but I am a hard worker and I need this job. Please help a brother and
American patriot in need.
int main(void) { return 0;;;;;;;;;;;;;;;;;;;; }
Jun 27 '08 #2
Thompson Reed <tr*******@botsview.comwrites:
Can someone give me an example C program with at least 20 lines of
source code. That is the requirement and a line of code is a semicolon
according to the rules. I have a job interview on Friday and they want
this the day before the interview. I am not a C expert like many of
you but I am a hard worker and I need this job. Please help a brother
and American patriot in need.

Thanks in advance -- Thompson R.
I'd be happier if the job went to someone who's actually able to write
a program himself, or at least who didn't try to cheat on a job
interview.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 27 '08 #3
Even if you are trying to cheat, I didn't quite get the situation.
Won't it be easier for you to google an algorithm and study the
implementation. And what kind of job you are vying for which requires
you to bring 20 lines of C code doing anything with you?
Jun 27 '08 #4
rahul wrote:

What are you replying to?

Please retain context.
Even if you are trying to cheat, I didn't quite get the situation.
Won't it be easier for you to google an algorithm and study the
implementation. And what kind of job you are vying for which requires
you to bring 20 lines of C code doing anything with you?

--
Ian Collins.
Jun 27 '08 #5
Very interesting.

"Keith Thompson" <ks***@mib.org??????:ln************@nuthaus.mib.or g...
Thompson Reed <tr*******@botsview.comwrites:
>Can someone give me an example C program with at least 20 lines of
source code. That is the requirement and a line of code is a semicolon
according to the rules. I have a job interview on Friday and they want
this the day before the interview. I am not a C expert like many of
you but I am a hard worker and I need this job. Please help a brother
and American patriot in need.

Thanks in advance -- Thompson R.

I'd be happier if the job went to someone who's actually able to write
a program himself, or at least who didn't try to cheat on a job
interview.

--
Keith Thompson (The_Other_Keith) ks***@mib.org
<http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"

Jun 27 '08 #6

"Thompson Reed" <tr*******@botsview.comwrote in message
news:kZ**************@newsfe07.lga...
Can someone give me an example C program with at least 20 lines of source
code. That is the requirement and a line of code is a semicolon according
to the rules. I have a job interview on Friday and they want this the day
before the interview. I am not a C expert like many of you but I am a hard
worker and I need this job. Please help a brother and American patriot in
need.
Plenty of such examples here, and on the rest of the internet, and in
books...

But what will you do on your first day at work if you get the job?

Out of interest what was your last job?

-- bartc

Jun 27 '08 #7
On Tue, 03 Jun 2008 22:52:46 -0700, Keith Thompson wrote:
Thompson Reed <tr*******@botsview.comwrites:
>Can someone give me an example C program with at least 20 lines of
source code. That is the requirement and a line of code is a semicolon
according to the rules. I have a job interview on Friday and they want
this the day before the interview. I am not a C expert like many of
you but I am a hard worker and I need this job. Please help a brother
and American patriot in need.

Thanks in advance -- Thompson R.

I'd be happier if the job went to someone who's actually able to write
a program himself, or at least who didn't try to cheat on a job
interview.
Start with int main.

Ask whether processing command line args is relevant. If not, then let
main expect nothing: make its argument void.

Beyond that, try to spell correctly, which is how I usually commend federal
officers. Be more portable than Jabba the Hut. Good luck,
--
Ron Ford
Jun 27 '08 #8
Ron Ford said:

<snip>
>
Beyond that, try to spell correctly, which is how I usually commend
federal officers. Be more portable than Jabba the Hut.
That's "Hutt". Congratulations on retaining a cents of tradition where
spelling flames are concerned.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 27 '08 #9
>>>>"TR" == Thompson Reed <tr*******@botsview.comwrites:

TRCan someone give me an example C program with at least 20 lines
TRof source code. That is the requirement and a line of code is a
TRsemicolon according to the rules. I have a job interview on
TRFriday and they want this the day before the interview. I am not
TRa C expert like many of you but I am a hard worker and I need
TRthis job.

You realize that, if the interviewer is at all good, he or she will ask
you what the program does, and probably ask you to answer some technical
C questions and write another 20 or so lines of code in the actual
interview?

And you realize that HR people talk to other HR people from other
companies - a lot?

So the likely outcome of someone sending you code -- assuming they send
you correct code, in an effort to help -- is that you get into the
interview, the interviewer realizes you have no C skills at all, the
interview ends, and word gets out that you're a fraud.

*Not* the outcome I'd hope for.

TRPlease help a brother and American patriot in need.

If you were my brother, you'd have enough self-respect to not do such an
asinine thing. And calling yourself an "American patriot" while
attempting to perpetrate a fraud is disgraceful.

Charlton

--
Charlton Wilbur
cw*****@chromatico.net
Jun 27 '08 #10
In comp.lang.c, Thompson Reed wrote:
Can someone give me an example C program with at least 20 lines of
source code.That is the requirement and a line of code is a semicolon
according to the rules. I have a job interview on Friday and they want
this the day before the interview.
May I suggest the code at http://www0.us.ioccc.org/2000/dhyang.c ?
I am not a C expert like many of you but I am a hard worker and I need
this job.
[snip]
--
Lew Pitcher

Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/ | GPG public key available by request
---------- Slackware - Because I know what I'm doing. ------
Jun 27 '08 #11
On Jun 3, 10:45*pm, Thompson Reed <treed1...@botsview.comwrote:
Can someone give me an example C program with at least 20 lines of
source code. That is the requirement and a line of code is a semicolon
according to the rules.
That simplifies things:
void i void(){;;;;;;;;;;;;;;;;;;;;}
>I have a job interview on Friday and they want
this the day before the interview. I am not a C expert like many of you
but I am a hard worker and I need this job.
I won't apply for a brain surgeon's position. Do you know why?
Because I don't know how to operate on brains.
Please help a brother and
American patriot in need.
One of the better trolls I have seen lately. Pretty funny, actually.
Jun 27 '08 #12
On Jun 4, 11:46*am, user923005 <dcor...@connx.comwrote:
On Jun 3, 10:45*pm, Thompson Reed <treed1...@botsview.comwrote:
Can someone give me an example C program with at least 20 lines of
source code. That is the requirement and a line of code is a semicolon
according to the rules.

That simplifies things:
void i void(){;;;;;;;;;;;;;;;;;;;;}
Hey, one defect in 20 lines isn't that bad.
void i (void){;;;;;;;;;;;;;;;;;;;;}
I have a job interview on Friday and they want
this the day before the interview. I am not a C expert like many of you
but I am a hard worker and I need this job.

I won't apply for a brain surgeon's position. *Do you know why?
Because I don't know how to operate on brains.
Please help a brother and
American patriot in need.

One of the better trolls I have seen lately. *Pretty funny, actually.
Jun 27 '08 #13
On Wed, 04 Jun 2008 11:01:10 +0000, Richard Heathfield wrote:
Ron Ford said:

<snip>
>>
Beyond that, try to spell correctly, which is how I usually commend
federal officers. Be more portable than Jabba the Hut.

That's "Hutt". Congratulations on retaining a cents of tradition where
spelling flames are concerned.
I wrote a perl program that read the subject of a usenet message, and if it
contained the word "jabba," then the output was to be the words of the
subject with the ultimate word reversed. I thought I succeeded when the
output was "jabba the tuh." Apparently not.
--
Ron Ford
Jun 27 '08 #14
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
101
I have a job interview on Friday and they want
this the day before the interview. I am not a C expert like many of you
but I am a hard worker and I need this job. Please help a brother and
American patriot in need.

Thanks in advance -- Thompson R.

(As an exercise, write a C program that can generate the
program below... many interviewers are very impressed by that)
/* begin sample.c */
#include <stdio.h>

#define PRINTSIZE(t) \
do { \
fprintf(stdout, "%-32s: %lu\n", \
"sizeof(" #t ")", \
(unsigned long)sizeof(t)); \
} while(0)

int main(void)
{
PRINTSIZE(char);
PRINTSIZE(signed char);
PRINTSIZE(char signed);
PRINTSIZE(unsigned char);
PRINTSIZE(char unsigned);
PRINTSIZE(short);
PRINTSIZE(signed short);
PRINTSIZE(short signed);
PRINTSIZE(short int);
PRINTSIZE(int short);
PRINTSIZE(signed short int);
PRINTSIZE(signed int short);
PRINTSIZE(short signed int);
PRINTSIZE(short int signed);
PRINTSIZE(int signed short);
PRINTSIZE(int short signed);
PRINTSIZE(unsigned short);
PRINTSIZE(short unsigned);
PRINTSIZE(unsigned short int);
PRINTSIZE(unsigned int short);
PRINTSIZE(short unsigned int);
PRINTSIZE(short int unsigned);
PRINTSIZE(int unsigned short);
PRINTSIZE(int short unsigned);
PRINTSIZE(int);
PRINTSIZE(signed);
PRINTSIZE(signed int);
PRINTSIZE(int signed);
PRINTSIZE(unsigned);
PRINTSIZE(unsigned int);
PRINTSIZE(int unsigned);
PRINTSIZE(long);
PRINTSIZE(signed long);
PRINTSIZE(long signed);
PRINTSIZE(long int);
PRINTSIZE(int long);
PRINTSIZE(signed long int);
PRINTSIZE(signed int long);
PRINTSIZE(long signed int);
PRINTSIZE(long int signed);
PRINTSIZE(int signed long);
PRINTSIZE(int long signed);
PRINTSIZE(unsigned long);
PRINTSIZE(long unsigned);
PRINTSIZE(unsigned long int);
PRINTSIZE(unsigned int long);
PRINTSIZE(long unsigned int);
PRINTSIZE(long int unsigned);
PRINTSIZE(int unsigned long);
PRINTSIZE(int long unsigned);

#if __STDC_VERSION__ >= 199901L
PRINTSIZE(long long);
PRINTSIZE(signed long long);
PRINTSIZE(long signed long);
PRINTSIZE(long long signed);
PRINTSIZE(long long int);
PRINTSIZE(long int long);
PRINTSIZE(int long long);
PRINTSIZE(signed long long int);
PRINTSIZE(signed long int long);
PRINTSIZE(signed int long long);
PRINTSIZE(long signed long int);
PRINTSIZE(long signed int long);
PRINTSIZE(long long signed int);
PRINTSIZE(long long int signed);
PRINTSIZE(long int signed long);
PRINTSIZE(long int long signed);
PRINTSIZE(int signed long long);
PRINTSIZE(int long signed long);
PRINTSIZE(int long long signed);
PRINTSIZE(unsigned long long);
PRINTSIZE(long unsigned long);
PRINTSIZE(long long unsigned);
PRINTSIZE(unsigned long long int);
PRINTSIZE(unsigned long int long);
PRINTSIZE(unsigned int long long);
PRINTSIZE(long unsigned long int);
PRINTSIZE(long unsigned int long);
PRINTSIZE(long long unsigned int);
PRINTSIZE(long long int unsigned);
PRINTSIZE(long int unsigned long);
PRINTSIZE(long int long unsigned);
PRINTSIZE(int unsigned long long);
PRINTSIZE(int long unsigned long);
PRINTSIZE(int long long unsigned);
#endif

PRINTSIZE(float);
PRINTSIZE(double);
PRINTSIZE(long double);
PRINTSIZE(double long);

#if __STDC_VERSION__ >= 199901L
PRINTSIZE(_Bool);
PRINTSIZE(float _Complex);
PRINTSIZE(_Complex float);
PRINTSIZE(double _Complex);
PRINTSIZE(_Complex double);
PRINTSIZE(long double _Complex);
PRINTSIZE(long _Complex double);
PRINTSIZE(double long _Complex);
PRINTSIZE(double _Complex long);
PRINTSIZE(_Complex long double);
PRINTSIZE(_Complex double long);
#endif

return 0;
}
/* end sample.c */

--
John J. Smith
Jun 27 '08 #15
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
Jun 27 '08 #16
jaysome schrieb:
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(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(_Bool);
sample.c(107) : Info 717: do ... while(0);
This builds not with LCC-WIN32 also:

Warning sample.c: 67 multiple use of 'long'
Warning sample.c: 70 multiple use of 'long'
Warning sample.c: 71 multiple use of 'longlong'
Warning sample.c: 73 multiple use of 'long'
Warning sample.c: 74 multiple use of 'longlong'
Warning sample.c: 75 multiple use of 'long'
Warning sample.c: 76 multiple use of 'long'
Warning sample.c: 77 multiple use of 'int'
Warning sample.c: 79 multiple use of 'long'
Warning sample.c: 80 multiple use of 'long'
Warning sample.c: 81 multiple use of 'longlong'
Warning sample.c: 82 multiple use of 'long'
Warning sample.c: 83 multiple use of 'longlong'
Warning sample.c: 85 multiple use of 'long'
Warning sample.c: 88 multiple use of 'long'
Warning sample.c: 89 multiple use of 'longlong'
Warning sample.c: 90 multiple use of 'long'
Warning sample.c: 91 multiple use of 'long'
Warning sample.c: 92 multiple use of 'int'
Warning sample.c: 94 multiple use of 'long'
Warning sample.c: 95 multiple use of 'long'
Warning sample.c: 96 multiple use of 'longlong'
Warning sample.c: 97 multiple use of 'long'
Warning sample.c: 98 multiple use of 'longlong'
Warning sample.c: 109 No type specified for _Complex. Defaulting to double
Warning sample.c: 109 no type specified. Defaulting to int
Error sample.c: 109 syntax error; found `float' expecting ')'
Error sample.c: 109 syntax error; found `float' expecting ')'
Error sample.c: 109 Syntax error; missing semicolon before `float'
Error sample.c: 109 empty declaration
Error sample.c: 109 Syntax error; missing semicolon before `)'
Error sample.c: 109 skipping `)' `)'
Warning sample.c: 111 No type specified for _Complex. Defaulting to double
Warning sample.c: 111 no type specified. Defaulting to int
Error sample.c: 111 syntax error; found `double' expecting ')'
Error sample.c: 111 syntax error; found `double' expecting ')'
Error sample.c: 111 Syntax error; missing semicolon before `double'
Error sample.c: 111 empty declaration
Error sample.c: 111 Syntax error; missing semicolon before `)'
Error sample.c: 111 skipping `)' `)'
Warning sample.c: 113 multiple use of 'double'
Warning sample.c: 114 multiple use of '_Complex'
Warning sample.c: 116 No type specified for _Complex. Defaulting to double
Warning sample.c: 116 no type specified. Defaulting to int
Error sample.c: 116 syntax error; found `long' expecting ')'
Error sample.c: 116 syntax error; found `long' expecting ')'
Error sample.c: 116 Syntax error; missing semicolon before `long'
Error sample.c: 116 empty declaration
Error sample.c: 116 Syntax error; missing semicolon before `)'
Error sample.c: 116 skipping `)' `)'
Warning sample.c: 117 No type specified for _Complex. Defaulting to double
Warning sample.c: 117 no type specified. Defaulting to int
Error sample.c: 117 syntax error; found `double' expecting ')'
Error sample.c: 117 syntax error; found `double' expecting ')'
Error sample.c: 117 too many errors
1 error

Jun 27 '08 #17
Hans Schneider wrote, On 06/06/08 14:15:
jaysome schrieb:
>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.
So? That was just a quick way to show you how many semi-colons were in
the source.
>[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(104) : warning C4127: conditional expression is constant

sample.obj - 0 error(s), 54 warning(s)
Well, that is 54 warnings for a common, useful and sensible trick to
allow you to use a macro in the way a lot of people would expect.
>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(_Bool);
sample.c(107) : Info 717: do ... while(0);
Again, that is generating warnings for a valid useful way of doing things.
This builds not with LCC-WIN32 also:

Warning sample.c: 67 multiple use of 'long'
Warning sample.c: 70 multiple use of 'long'
Warning sample.c: 71 multiple use of 'longlong'
<snip>

We've already got a thread discussing these problems.
Warning sample.c: 109 No type specified for _Complex. Defaulting to double
Warning sample.c: 109 no type specified. Defaulting to int
Error sample.c: 109 syntax error; found `float' expecting ')'
Error sample.c: 109 syntax error; found `float' expecting ')'
Error sample.c: 109 Syntax error; missing semicolon before `float'
Error sample.c: 109 empty declaration
Error sample.c: 109 Syntax error; missing semicolon before `)'
Error sample.c: 109 skipping `)' `)'
<snip>

That just looks like another example of the same problem with lcc-win32
to me.

I don't think there is anything wrong with the code posted by John Smith
and gcc agrees with me.
--
Flash Gordon
Jun 27 '08 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ville Vainio | last post by:
Just posting this for the sake of google: Like everyone else, I figured it's time to start using the 'logging' module. I typically want to dump "info" level (and up) log information to...
8
by: Uwe Mayer | last post by:
Hi, can someone provide me with a running example for subclassing QWidget (or something similarly simple) in C++ and then creating SIP (4.x+) bindings for in for Python (2.3+)? I am looking...
1
by: Bo Xu | last post by:
Object of Combination By Bo Xu Introduction A combination of n things, taken s at a time, often referred as an s-combination out of n, is a way to select a subset of size s from a given set of...
23
by: Alberto | last post by:
An OUTSTANDING example of a rebuttal. Worth a glance. Rather long, OBVIOUSLY feel fee to dismiss it entirely if not interested. But this habit of the rebuttals must go to a stop (forgive odd...
12
by: Xah Lee | last post by:
Python Doc Problem Example Quote from: http://docs.python.org/lib/module-os.path.html ---------- split( path) Split the pathname path into a pair, (head, tail) where tail is the last...
20
by: Xah Lee | last post by:
Sort a List Xah Lee, 200510 In this page, we show how to sort a list in Python & Perl and also discuss some math of sort. To sort a list in Python, use the “sort” method. For example: ...
10
by: Bart Goeman | last post by:
Hi, I have a question about how to put redundant information in data structures, initialized at compile time. This is often necessary for performance reasons and can't be done at run time (data...
13
by: KV | last post by:
I'm new to OO Design, and I'm fixing to start writing my very first C# program. Given the complexity of OO programming, I would like to run something by this group and get general input. My...
12
by: emma_middlebrook | last post by:
Hi Say you had N threads doing some jobs (not from a shared queue or anything like that, they each know how to do their own set of jobs in a self-contained way). How can you coordinate them so...
25
by: meltedown | last post by:
This is supposed ot be an example: http://www.ajaxtutorial.net/index.php/2006/11/30/simple-ajax-using-prototype-part-2/ It says : This example is probably the simplest example you will ever...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.