Print numbers according to their native promoted type1632 (6/15/2012 7:06:50 PM) comp.lang.c Hi,
the C library has weird number printing functions:
sprintf(str, "%d", num_signed)
sprintf(str, "%u", num_unsigned)
I've created a nice macro SPRINTNUM(STR, EXPR), that handles this
automatically,... John
Determining the 'type' of a variable, if only its name is given1343 (6/15/2012 8:47:55 AM) comp.lang.c Hi,
is it possible, to determine the 'type' of a variable, if only its
name is given.
With 'type', I don't mean the exact type, such as enum, but instead
the following information:
a) sizeof
b) signed... John
standard C? -> int b = ({int a; a = 5; a;})347 (6/14/2012 8:23:42 AM) comp.lang.c Hello,
is it standard C... that the value obtained when evaluating a block is
the last expression in the block??
Example:
int b = ( {
int a;
a = 5;
... John
Array addressing styles: arr[i].d[j] versus pArr->d[j], etc.723 (5/27/2012 5:30:55 PM) comp.lang.c Hi!
In writing code I often find numerous ways of expressing the same
thing.
I have some questions of "style" and "optimization" that I'd like to
ask.
Example1
========
Variant 1a)
arr[i].a = f1... John
condition true or false? -> (-1 < sizeof("test"))5324 (5/17/2012 8:40:08 AM) comp.lang.c Hello, please can someone explain why (-1 int main(void) { int i; if (-1 = -3; i--) { if (i #include #if EOF != -1 #error EOF is not -1 #endif int arr[UCHAR_MAX+2]... John
Possible occurrences of "char [3]"1333 (5/3/2012 9:03:18 PM) comp.lang.c Hi there, where could the following legally occurr in C code - not counting in strings ;) char [3] I can think only of: sizeof(char [3]); Are there any other possibilities? Thanks. ... John
Possible occurrences of "char [3]"1333 (5/3/2012 9:03:18 PM) comp.lang.c Hi there, where could the following legally occurr in C code - not counting in strings ;) char [3] I can think only of: sizeof(char [3]); Are there any other possibilities? Thanks. ... jononanon(82)
Print numbers according to their native promoted type1632 (6/15/2012 7:06:50 PM) comp.lang.c Hi,
the C library has weird number printing functions:
sprintf(str, "%d", num_signed)
sprintf(str, "%u", num_unsigned)
I've created a nice macro SPRINTNUM(STR, EXPR), that handles this
automatically,... jononanon(82)