function pointer is: datatype (* name) (parameter types)
array pointer is simply: datatype (* name) []
Right? or can i write it in another way without parenthesis? so i can figure out how it works better
function pointer is: datatype (* name) (parameter types)
array pointer is simply: datatype (* name) []
Right? or can i write it in another way without parenthesis? so i can figure out how it works better
Last edited by tzpb8; 07-26-2006 at 01:22 PM.
Oooh but when you say name is a type you make me think it's either int char or float etc, what i meant with name is the name of the pointer itself. You mean that name is an array? when you say name is an array type.. think i get it now then
Hmm the name array has three elements of function pointers with assigned parameters..
Before you edited your post you had (* void), that meant that the function had the type of void then?
Does this mean i can omit type when deciding what type of function they should point at (and get a default of void)?
Last edited by tzpb8; 07-26-2006 at 01:46 PM.
Think i'm on to something?
Code:#include <stdio.h> int sUP3r(int a); int g1uE(int a); int main(void){ int a = 18; int (* array[3]) (int sUP3r) (int blue); int (* n) = &a; int (* o); int (* p); *array = *n; sUP3r(a); g1uE(a); printf("\n%d",array[0]); return 0;} int sUP3r(int a){ int blue = 255; } int g1uE(int a){ a = a + 5; printf("%d",a); }
>int (* array[3]) (int sUP3r) (int blue);
What on earth is that supposed to be?
My best code is written with the delete key.
Man you're stupid. No. If you omit the type, it defaults to an int. This is why when you leave out the header file for say string functions, you keep getting "pointer from integer" conversion errors and warnings.Originally Posted by MDofRockyView
If you don't know the answer, don't try, just shut the hell up. You're a swirling vortex of misinformation. Please go away.
Quzah.
Hope is the first step on the road to disappointment.
an pointer array of three pointer types pointing to function type int named sUP3r with the parameter blue int type
> int sUP3r(int a);
> int g1uE(int a);
I'm sure I and some other people would appreciate it if you stopped writing tokens and function names in 1337 and jibberish.
There's a program on Linux (and other Unix systems) called "cdecl" which can help with C declarations.Originally Posted by tzpb8
Here's what I got with your line:
cdecl> explain int (* array[3]) (int sUP3r) (int blue);
parse error
So, what you're doing doesn't even parse properly....
Mr. Blonde: You ever listen to K-Billy's "Super Sounds of the Seventies" weekend? It's my personal favorite.
yeah i know lol.. thats why i asked if i'm on to something
'array' declared as function returning a function -is one of the warning i got
And horsecrap put in a pretty bag with a bow on it is still horsecrap.Originally Posted by tzpb8
You're certainly not making it easier for folks trying to help you.....
Mr. Blonde: You ever listen to K-Billy's "Super Sounds of the Seventies" weekend? It's my personal favorite.
If it's a problem i can stop writing numbers in function names, just thought it looked nicer.. like how you like to have whitespace
>an pointer array of three pointer types pointing to function type int named sUP3r with the parameter blue int type
Please, please take my advice about getting a strong foundation in the fundamentals before moving on to more advanced stuff. You're trying to move too quickly, and it's not helping. First, we have no interest in teaching you something you refuse to learn properly. Second, if you don't have a solid handle on the basics, everything built on those basics will be weak. In other words, you're on the path to becoming a horrible programmer.
I don't want to see that happen.
My best code is written with the delete key.
>I see, wanted to master pointers but guess its to early
Programming is a skill. Like any other skill, it takes time to master. If you get in a hurry and try to cram more and more into your head when you aren't prepared for it, you make things harder on yourself. Be patient, enjoy the ride, and mastery will come of its own accord.
My best code is written with the delete key.