void openfile(char *,FILE**)
what does double stars indicates

void openfile(char *,FILE**)
what does double stars indicates

The second argument type is a pointer to a pointer to FILE type.
Didn't you understand what's a pointer?
Evidently this function returns FILE* pointer via this argument. What's a strange perversion...

Well, it has one advantage over a return value -- you have to pass in an address, whereas you could ignore a return value. :) I don't think that's how I would write it, though.

>>you have to pass in an address

Not if you pass NULL.

How many times a pointer operator can appear with pointer to pointer declaration.

int a;
  int *p;
  int **q;
  int ***r;
  int ****s;
  ....

   p=&a;
   q=&p;
   r=&q;
   s=&r;
   ...

Is there any limit imposed by ANSI?

That's it:

5.2.4.1 Translation limits
1 The implementation shall be able to translate and execute at least one program that contains at least one instance of every one of the following limits:
...
- 12 pointer, array, and function declarators (in any combinations) modifying an arithmetic, structure, union, or incomplete type in a declaration
...
Implementations should avoid imposing fixed translation limits whenever possible.

(256 in C++)

Isn't 16 *'s maximum in C ???
I mean that *p,**p,***p.....

With VC++ 2008 Express, compiling a C program, I was able to compile char*(500 stars) ptr = "Hello"; before the parser complained. And then the error message was "parser stack overflow, program too complex"

Interestingly, as a c++ program I was able to give it about 920 stars before the compiler crapped out -- then it was during the link stage, not the compile stage.

curious, did you incrementally compile 1 additional indirection operator each time? did you use a scripting language to do it?

>Isn't 16 *'s maximum in C ???
I have never seen maximal values of translation limits were defined in C docs.

>Isn't 16 *'s maximum in C ???
I have never seen maximal values of translation limits were defined in C docs.

Well I had seen it being limited in some early versions of cc gcc and all .Actually had read about them somewhere "Not quite sure though".So asked it here.But don't know how Ancient Dragon found out the limit,but 500 and 920 are quite surprising !!!

@Ancient Dragon : Can I get the link where you found that out ? Or atleast the method ? And what do you think is the limit for POSIX and C99 compliant gcc version?

>Well I had seen it being limited in some early versions of cc gcc and all.
It was not the C language limit, it's a limit of the compiler (implementation),
>...Or atleast the method...
Generate a probe module by a simplest program in C then use binary search ;)

The way I found out the limits was to write a program that had a pointer with a bunch of stars.

>>did you incrementally compile 1 additional indirection operator each time?

Suuuure I did, and compiled it over 900 times just for this thread. And if you believe that I have some stocks in the Golden Gate Bridge I'll sell you :)

The way I found out the limits was to write a program that had a pointer with a bunch of stars.

>>did you incrementally compile 1 additional indirection operator each time?

Suuuure I did, and compiled it over 900 times just for this thread. And if you believe that I have some stocks in the Golden Gate Bridge I'll sell you :)

um, well, it would a fairly trivial matter to do so using Perl or some other scripting language. but i agree with you that we have better ways to spend our time.

just what i was wondering is along the lines of "hey great, so 900 stars fails..." but does 850? or 800? or 500? or 100?

IOW, where'd you get your magic number of 900?


.

>>IOW, where'd you get your magic number of 900?

trial and error. It was actually about 912. Held down the star key until 900+ stars appeared then tried to compile. When the compiler crapped out I backed out a few stars until I got a clean compile/link. My guess is that the compiler pushes something on the stack for each star.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.