Re: RunTime Datatype Determination in C
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Fri, 24 Nov 2006 02:16:32 -0500
dbansal wrote:
.... snip ...
I have a program. Please tell me what do you think about this.
ERROR: failure to #include <stdio.h>
int main(int x)
ERROR: main can have two or no parameters. Not one. Usual is:
int main(int argc, char **argv)
{
if(x==1)
{
int myval;
printf("size of integer myval: %d\n",sizeof (myval));
ERROR: printf without a prototype.
ERROR: sizeof returns size_t, not int. Use
("%lu\n", (unsigned long) sizeof myval);
}
else
{
float myval;
printf("size of real myval: %d\n",sizeof (myval));
ERROR: printf without a prototype.
ERROR: sizeof returns size_t, not int. See above.
}
ERROR: main returns int. "return 0;" will do.
}
So, apart from not being a legal C program, all is well.
--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
.
- Follow-Ups:
- Re: RunTime Datatype Determination in C
- From: dbansal
- Re: RunTime Datatype Determination in C
- References:
- RunTime Datatype Determination in C
- From: manish
- Re: RunTime Datatype Determination in C
- From: Richard Tobin
- Re: RunTime Datatype Determination in C
- From: dbansal
- RunTime Datatype Determination in C
- Prev by Date: Re: Need your HELP: C in LINUX
- Next by Date: Re: Question regarding fgets and new lines
- Previous by thread: Re: RunTime Datatype Determination in C
- Next by thread: Re: RunTime Datatype Determination in C
- Index(es):
Relevant Pages
|