Char Golf

Thursday, April 23rd, 2009

Char Golf
Getting the length of a string?

Ok so I have an array of char (name[20]) and normally I would use name.size() after I’ve put something in it. But name is in a structure so I did g.name.size() (the actual structure is called golf but it’s referenced by g). But I keep getting a compiler error. What’s wrong?

size() is a method of the C++ “string” class, but a string is more than just a character array. You can use the size method of the string class as follows:

#include
using namespace std;

string name = “John”;
cout<<"Name is "<

An array of characters does not have a size() method.

You can, however, find the size of a null-terminated c-string the following way:

char name[20] = "John";
int i=0;
while(name[i]) i++;
cout<<"Name is "<

eBay Logo  

NEW IVY DRIVING NEWSBOY FLEX GOLF CAP CHAR PINSTRIPE


NEW IVY DRIVING NEWSBOY FLEX GOLF CAP CHAR PINSTRIPE


$9.99


NEW 2012 TAYLORMADE CATALINA 3.0 GOLF DIVIDER CART BAG 14 WAY TOP BK/CHAR/WH


NEW 2012 TAYLORMADE CATALINA 3.0 GOLF DIVIDER CART BAG 14 WAY TOP BK/CHAR/WH


$159.99


NEW 2012 TAYLORMADE CATALINA 3.0 GOLF DIVIDER CART BAG 14 WAY TOP BK/CHAR/WH


NEW 2012 TAYLORMADE CATALINA 3.0 GOLF DIVIDER CART BAG 14 WAY TOP BK/CHAR/WH


$159.99


NEW 2012 TAYLORMADE CATALINA 3.0 GOLF DIVIDER CART BAG 14 WAY TOP BK/CHAR/WH


NEW 2012 TAYLORMADE CATALINA 3.0 GOLF DIVIDER CART BAG 14 WAY TOP BK/CHAR/WH


$159.99


NEW CALLAWAY HYPER LITE 3.0 STAND GOLF BAG BLK/CHAR/WHT


NEW CALLAWAY HYPER LITE 3.0 STAND GOLF BAG BLK/CHAR/WHT


$109.99


NEW 2012 TAYLORMADE CATALINA 3.0 GOLF DIVIDER CART BAG 14 WAY TOP BK/CHAR/WH


NEW 2012 TAYLORMADE CATALINA 3.0 GOLF DIVIDER CART BAG 14 WAY TOP BK/CHAR/WH


$159.99


Nike Golf  Nike Dry-Fit NWT Mens Polo Shirt   2XL Char


Nike Golf Nike Dry-Fit NWT Mens Polo Shirt 2XL Char


$39.99


NEW 2012 TAYLORMADE CATALINA 3.0 GOLF DIVIDER CART BAG 14 WAY TOP BK/CHAR/WH


NEW 2012 TAYLORMADE CATALINA 3.0 GOLF DIVIDER CART BAG 14 WAY TOP BK/CHAR/WH


$159.99


NEW 2012 TAYLORMADE CATALINA 3.0 GOLF DIVIDER CART BAG 14 WAY TOP BK/CHAR/WH


NEW 2012 TAYLORMADE CATALINA 3.0 GOLF DIVIDER CART BAG 14 WAY TOP BK/CHAR/WH


$159.99


NEW 2012 TAYLORMADE CATALINA 3.0 GOLF DIVIDER CART BAG 14 WAY TOP BK/CHAR/WH


NEW 2012 TAYLORMADE CATALINA 3.0 GOLF DIVIDER CART BAG 14 WAY TOP BK/CHAR/WH


$159.99


NEW CLEVELAND CLASSICS POLO GOLF SHIRT BOX OFFICE CHAR


NEW CLEVELAND CLASSICS POLO GOLF SHIRT BOX OFFICE CHAR


$19.99


NEW CLEVELAND CLASSICS POLO GOLF SHIRT BOX OFFICE CHAR


NEW CLEVELAND CLASSICS POLO GOLF SHIRT BOX OFFICE CHAR


$19.99


NEW CLEVELAND CLASSICS POLO GOLF SHIRT BOX OFFICE CHAR


NEW CLEVELAND CLASSICS POLO GOLF SHIRT BOX OFFICE CHAR


$19.99


NEW CLEVELAND CLASSICS POLO GOLF SHIRT BOX OFFICE CHAR


NEW CLEVELAND CLASSICS POLO GOLF SHIRT BOX OFFICE CHAR


$19.99


TITLEIST GOLF LIGHTWEIGHT  STAND BAG TB2SX6 CHAR/FOG/EGGPLANT


TITLEIST GOLF LIGHTWEIGHT STAND BAG TB2SX6 CHAR/FOG/EGGPLANT


$149.99


Titleist Cart Bag TB2CT5 Lightweight Cart Bag Golf Cart Friendly Black/Red /Char


Titleist Cart Bag TB2CT5 Lightweight Cart Bag Golf Cart Friendly Black/Red /Char


$189.99


NEW IN BOX WOMENS NIKE AIR SUMMER LITE II CHAR/PINK/PLAID SIZE 6.5 GOLF SHOE


NEW IN BOX WOMENS NIKE AIR SUMMER LITE II CHAR/PINK/PLAID SIZE 6.5 GOLF SHOE


$69.99


NEW IN BOX WOMENS NIKE AIR SUMMER LITE II CHAR/PINK/PLAID SIZE 7.5 GOLF SHOE


NEW IN BOX WOMENS NIKE AIR SUMMER LITE II CHAR/PINK/PLAID SIZE 7.5 GOLF SHOE


$69.99


NEW 2012 TAYLORMADE CATALINA 3.0 GOLF DIVIDER CART BAG 14 WAY TOP BK/CHAR/WH


NEW 2012 TAYLORMADE CATALINA 3.0 GOLF DIVIDER CART BAG 14 WAY TOP BK/CHAR/WH


$199.95


Nike Air Brassie III Ladies Golf Shoes Char/Silv M 8.5


Nike Air Brassie III Ladies Golf Shoes Char/Silv M 8.5


$29.99


NEW WITH TAGS SUN MOUNTAIN SUPERLIGHT 3.5 STAND CARRY GOLF BAG (RED/CHAR/BLACK)


NEW WITH TAGS SUN MOUNTAIN SUPERLIGHT 3.5 STAND CARRY GOLF BAG (RED/CHAR/BLACK)


$159.99



Gellas by ShedRain 4532 Gel Handle, 62-Inch Arc Auto Open Vented Square Golf Umbrella


Gellas by ShedRain 4532 Gel Handle, 62-Inch Arc Auto Open Vented Square Golf Umbrella



ShedRain combines its gel-filled handle softness with its aerodynamic vented infrastructure toughness to resist high winds without inversion….


Ping Men's Ranger Cap (One Size, 2012) Golf Hat NEW


Ping Men’s Ranger Cap (One Size, 2012) Golf Hat NEW



Headwear Specifications: COMPANY / BRAND: Ping MODEL: Men’s Ranger Cap, 2012 SIZE: One size fits all CONDITION: New CONDITION SPECIFICS: New condition 10, nice men’s ranger cap! …


Woolrich Men's Hickory Flats Mock


Woolrich Men’s Hickory Flats Mock



Woolrich – Wide ribs in a medium-weight lambswool give the Hickory Flats Mock wool sweater a laid-back attitude. Comfort fleece-lined collar four-button placket front. 70% lambswool/30% nylon. Imported. Dry clean….


Executive SPORT SEAT


Executive SPORT SEAT



Product Description: Executive SPORT SEAT – This PORTABLE SEAT / CHAIR is also a folding WALKING STICK / CANE that is light-weight and strong. Folded, SPORT SEAT is a walking stick for hiking hills, watching or playing golf, walking the local shopping mall, or better yet, making walking possible if your legs are tired or injured. Unfolded, it’s a seat that lets you rest your legs at your convenien…


Hookers, Lies and Penalties


Hookers, Lies and Penalties


$16.13


Most golf books are so technical and lesson based that they turn off the newcomers to the game, especially women. NOT Hookers, Lies and Penalties! This is a humorous story with whimsical illustrations about two women learning the game of golf. Through the zany conversations of the two characters, the reader is introduced to the equipment, clothing, golf etiquette and basic rules of the game. Then …

Winter Rules


Winter Rules


$4.55


Cork’s golf-loving inspector Angus Trum finds a new mystery as he plays host to an African head-of-state and then travels to Africa, getting involved with the building of that county’s first golf course and the trade in smuggled cars….

New Key to Power Golf, the Secret Lever


New Key to Power Golf, the Secret Lever


$13.95



Nike 2010 Lady Ace Golf Shoes


Nike 2010 Lady Ace Golf Shoes



Take your most comfortable pair of shoes, pump in maximum NIKE Air cushioning, screw on some grass-gripping spikes and walk yards of beautiful grass. Repeat as often as necessary….


ASICS Gel Galaxy 5 GS Running Shoe (Little Kid/Big Kid)


ASICS Gel Galaxy 5 GS Running Shoe (Little Kid/Big Kid)


$45.00


Asics Junior GEL Galaxy 5 GS Athletic Shoes…

Ping Golf 4 Under Stand Bag


Ping Golf 4 Under Stand Bag


$189.99


The lightest of all PING Stand Bags, the 4 under meets the needs of the golfer who walks the course with a purpose. The sleek design, made of a lightweight nylon, offers four functional pockets and a simplified four-way top with two full-length dividers to keep the bag’s weight low and performance high. Its frame design provides tight leg retraction and the patented retractable strap system featur…