C Board  

Go Back   C Board > Community Boards > General Discussions

View Poll Results: How do you define pointers?
type* var; 1 20.00%
type *var; 4 80.00%
type * var; 0 0%
another way (please post) 0 0%
Multiple Choice Poll. Voters: 5. You may not vote on this poll

Closed Thread
 
LinkBack Thread Tools Display Modes
Old 08-23-2005, 03:50 AM   #1
EOF
 
Join Date: Aug 2005
Location: Constanta, RO, Europe
Posts: 46
Exclamation *** pointer madness revisited

let's see the civil war
__________________
Two strings walk into a bar. The first one says, 'Bartender! Bartender! I want a drink!'. The second one says, 'Bartender! Bartender! I want a drink too! Blaaaaaaaaah eeeeeeeek yaaaaaaak oooooooh'. The first one says, 'Please excuse my friend. He isn't null term--'.
moonlord is offline  
Old 08-23-2005, 04:09 AM   #2
Registered User
 
major_small's Avatar
 
Join Date: May 2003
Posts: 2,787
generally, I declare one variable/line, so I declare them like:
Code:
type*var;
but if I'm listing on line line,
Code:
type *var,var,var,*var,var;
and in that line I point out why the other two cases are just wrong.

for the people that want to get into it (I don't): you're not declaring a type of pointer, you're declaring a pointer to a type. the "var" in your example is the pointer, so it should get the '*'. giving the '*' to the type makes it look like you're trying to say that the type is a pointer to a type, when what you really mean to say is that it's a pointer to a type.

and civil wars aren't civil:
Code:
#include<iostream>

int main()
{
	int a,*b,**c,***d,****e;
	b=&a;
	c=&b;
	d=&c;
	e=&d;
	****e=0;
	std::cout<<a<<'\n'<<*b<<'\n'<<**c<<'\n'<<***d<<'\n'<<****e<<std::endl;
	return 0;
}
yeah, I don't know what that had to do with anything, either.
__________________
Join is in our Unofficial Cprog IRC channel
Server: irc.phoenixradio.org
Channel: #Tech


Team Cprog Folding@Home: Team #43476
Download it Here
Detailed Stats Here
More Detailed Stats
52 Members so far, are YOU a member?
Current team score: 1223226 (ranked 374 of 45152)

The CBoard team is doing better than 99.16% of the other teams
Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

Last edited by major_small; 08-23-2005 at 04:17 AM.
major_small is offline  
Old 08-23-2005, 05:55 AM   #3
and the hat of Jobseeking
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,710
This was just done - this is pointless.
Difference b/w int* p1 and int *p1
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.

Salem is offline  
Closed Thread

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in compiling targa2.c: error: field `ip' has incomplete type.. Moony C Programming 0 03-20-2008 07:59 AM
Parameter passing with pointer to pointer notsure C++ Programming 15 08-12-2006 07:12 AM
Direct3D problem ahluka Game Programming 10 04-09-2006 03:36 AM
How did you master pointers? Afrinux C Programming 15 01-17-2006 08:23 PM
Struct *** initialization Saravanan C Programming 20 10-09-2003 12:04 PM


All times are GMT -6. The time now is 11:13 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22