What does the following declare?
char*(*(*x)(void))[];
How to judge these type of questions? I am confused :( 8 1209
jeniffer wrote:
What does the following declare?
char*(*(*x)(void))[];
A pointer to a function taking no arguments, and returning a pointer to an
array of unspecified length of pointers to char.
How to judge these type of questions? I am confused :(
See http://www.c-faq.com/ question 1.21, and remind to whoever wrote that
stuff that typedef exists. :-)
--
Army1987
jeniffer said:
What does the following declare?
char*(*(*x)(void))[];
Others have already answered this part of your question.
How to judge these type of questions? I am confused :(
Judge these types of questions harshly. The question you show is
practically meaningless, because it tests a skill that is only needed when
deconstructing and rewriting badly-written code.
--
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
On Dec 27, 1:23 pm, Richard Heathfield <r...@see.sig.invalidwrote:
jeniffer said:
What does the following declare?
char*(*(*x)(void))[];
Others have already answered this part of your question.
How to judge these type of questions? I am confused :(
Judge these types of questions harshly. The question you show is
practically meaningless, because it tests a skill that is only needed when
deconstructing and rewriting badly-written code.
What if you are writing a C compiler or something similar?
Shall the compiler error because the programmer used a 'bad' data
type? vi******@gmail.com said:
On Dec 27, 1:23 pm, Richard Heathfield <r...@see.sig.invalidwrote:
>jeniffer said:
What does the following declare?
char*(*(*x)(void))[];
Others have already answered this part of your question.
How to judge these type of questions? I am confused :(
Judge these types of questions harshly. The question you show is practically meaningless, because it tests a skill that is only needed when deconstructing and rewriting badly-written code.
What if you are writing a C compiler or something similar?
What if you are? :-)
Shall the compiler error because the programmer used a 'bad' data
type?
The compiler should diagnose syntax errors and constraint violations, but
the above is not either of those. It follows the rules of the grammar, and
so the compiler writer will be able to deal with it simply by implementing
the grammar, which is a darn sight easier than decoding the above. (But
yes, okay, you're right - a compiler writer ought to be able to decode
such expressions by hand, even if it's only for testing purposes.)
--
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 vi******@gmail.com writes:
On Dec 27, 1:23 pm, Richard Heathfield <r...@see.sig.invalidwrote:
>jeniffer said:
What does the following declare?
char*(*(*x)(void))[];
Others have already answered this part of your question.
How to judge these type of questions? I am confused :(
Judge these types of questions harshly. The question you show is practically meaningless, because it tests a skill that is only needed when deconstructing and rewriting badly-written code.
What if you are writing a C compiler or something similar?
I surely would not mind if the C compiler diagnosed the above
similar to:
foo.c:6: warning: complicated type declarations are difficult to understand
--
char a[]="\n .CJacehknorstu";int putchar(int);int main(void){unsigned long b[]
={0x67dffdff,0x9aa9aa6a,0xa77ffda9,0x7da6aa6a,0xa6 7f6aaa,0xaa9aa9f6,0x11f6},*p
=b,i=24;for(;p+=!*p;*p/=4)switch(0[p]&3)case 0:{return 0;for(p--;i--;i--)case+
2:{i++;if(i)break;else default:continue;if(0)case 1:putchar(a[i&15]);break;}}}
"jeniffer" <ze******************@gmail.comwrote in message
news:2a**********************************@e25g2000 prg.googlegroups.com...
What does the following declare?
char*(*(*x)(void))[];
How to judge these type of questions? I am confused :(
E:\>cdecl
Type `help' or `?' for help
cdeclexplain char*(*(*x)(void))[];
declare x as pointer to function (void) returning pointer to array of
pointer to char
cdecl>
Look on the net for cdecl.zip
There are other distributions as well (e.g. in BSD code base)
--
Posted via a free Usenet account from http://www.teranews.com
Dann Corbit said:
<snip>
Look on the net for cdecl.zip
I have done so. I even found it. The zip file was corrupted...
There are other distributions as well (e.g. in BSD code base)
....so I found a version written by Graham Ross, supposedly converted to
ANSI C by David Wolverton, which didn't compile. Once I got it to compile
(by removing features), it didn't link. Once I got it to link (by removing
more features), it didn't run (segfaulted straight away).
The cdecl functionality is a perfectly good example of code that *could* be
written in solid, clc-conforming ISO C code. And who knows? Perhaps it has
been. If so, where may it be found? And if not, well, I'll add it to my
to-do list.
--
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
On Dec 28, 12:00*am, Richard Heathfield <r...@see.sig.invalidwrote:
Dann Corbit said:
<snip>
Look on the net for cdecl.zip
I have done so. I even found it. The zip file was corrupted...
There are other distributions as well (e.g. in BSD code base)
...so I found a version written by Graham Ross, supposedly converted to
ANSI C by David Wolverton, which didn't compile. Once I got it to compile
(by removing features), it didn't link. Once I got it to link (by removing
more features), it didn't run (segfaulted straight away).
The cdecl functionality is a perfectly good example of code that *could* be
written in solid, clc-conforming ISO C code. And who knows? Perhaps it has
been. If so, where may it be found? And if not, well, I'll add it to my
to-do list.
The one that I have builds fine with MINGW, but not with ANSI/ISO C
because it uses POSIX features. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: CoolPint |
last post by:
Can anyone clearly explain the difference between constant reference to
pointers and reference to constant pointers?
What is const int * & ?
Is it a constant reference to a pointer to an...
|
by: Asif |
last post by:
Hi there,
I have been trying to understand the behaviour of char (*pfn)(null)
for a couple of days. can some body help me understand the behaviour
of char (*pfn)(null) in Visual C++ environment?...
|
by: Steven T. Hatton |
last post by:
I'm reading through Kyle Loudon's _C++_Pocket_Reference_ for the sake of
review. He uses the notational form used by Kernighan and Ritchie in
declaring pointers (and by extension references). ...
|
by: pandapower |
last post by:
Hi,
I know about the equivalence of pointer and arrays.But my doubt
comes when its for multidimentional arrays.I have read the C faq but
still have some doubts.
Suppose I have a declaration as...
|
by: rs |
last post by:
Just out of idle curiosity:
1)Regarding pointers; I don't have the standard/grammar with me, but T* for
type T mean pointer-to-T. Does that mean that with a declaration of type
T** is actually...
|
by: Adam Warner |
last post by:
Hi all,
Just before Christmas Chris Torek gave me some great advice about closures in C:
<http://groups.google.co.nz/groups?selm=cqcl3k030vj%40news3.newsguy.com&output=gplain>
It includes this...
|
by: Michael |
last post by:
Hi,
I am trying to pass a function an array of strings, but I am having trouble
getting the indexing to index the strings rather than the individual
characters of one of the strings.
I have...
|
by: mdh |
last post by:
>From p112 ( K&R).
Given an array declared as
static char arr= { { 0,1,........},{0,1,.....}};
let arr be passed as an argument to f.
f( int (*arr) ) {....}
It is noted that the...
|
by: mdh |
last post by:
May I ask the following.
By K&R's own admission, the example used to describe function pointers
is complex ( on P119). In addition, the use of casts has been stated
by some on this group as...
|
by: Pilcrow |
last post by:
In the code below, can someone explain why the asterisks seem to be
required on the line labelled 'A' and forbidden on the line labelled
'B'?
Thanks in advance for the help....
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |