View Poll Results: How do you define pointers?

Voters
5. You may not vote on this poll
  • type* var;

    1 20.00%
  • type *var;

    4 80.00%
  • type * var;

    0 0%
  • another way (please post)

    0 0%
Multiple Choice Poll.

*** pointer madness revisited

This is a discussion on *** pointer madness revisited within the A Brief History of Cprogramming.com forums, part of the Community Boards category; let's see the civil war...

  1. #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--'.

  2. #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.
    Last edited by major_small; 08-23-2005 at 05:17 AM.
    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

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,767
    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.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 0
    Last Post: 03-20-2008, 08:59 AM
  2. Parameter passing with pointer to pointer
    By notsure in forum C++ Programming
    Replies: 15
    Last Post: 08-12-2006, 08:12 AM
  3. Direct3D problem
    By cboard_member in forum Game Programming
    Replies: 10
    Last Post: 04-09-2006, 04:36 AM
  4. How did you master pointers?
    By Afrinux in forum C Programming
    Replies: 15
    Last Post: 01-17-2006, 08:23 PM
  5. Struct *** initialization
    By Saravanan in forum C Programming
    Replies: 20
    Last Post: 10-09-2003, 01:04 PM

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