vector of string

Reply

Join Date: Nov 2007
Posts: 9
Reputation: aaabhish is an unknown quantity at this point 
Solved Threads: 0
aaabhish aaabhish is offline Offline
Newbie Poster

vector of string

 
0
  #1
Nov 14th, 2007
hi,

i have a doubt in vector strings what are these vector strings.
and if this is a vector how to find the dimention of these vector or what
is the dimention of this vector.

and how to do vector string things in c language.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: vector of string

 
0
  #2
Nov 14th, 2007
C doesn't have anything like say std::vector<std::string> of C++.

So the question becomes how much of it are you going to simulate in C, say using some 'class-like' functions and dynamic memory allocation.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 34
Reputation: mohanrobin has a little shameless behaviour in the past 
Solved Threads: 0
mohanrobin mohanrobin is offline Offline
Light Poster

Re: vector of string

 
0
  #3
Nov 14th, 2007
i think vector strings are generic functions that you have to study generic files which is in c language.the vector strings can see in some textb books.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,951
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: vector of string

 
0
  #4
Nov 14th, 2007
Listen to Salem. C does not have a vector anything. Nor does it have generic anything. Those are both C++ constructs.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 9
Reputation: aaabhish is an unknown quantity at this point 
Solved Threads: 0
aaabhish aaabhish is offline Offline
Newbie Poster

Re: vector of string

 
0
  #5
Nov 15th, 2007
ok, but i think it can be done using memory allocation funtion like melloc and calloc.
but have a confusion what i called as vector dimention.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 9
Reputation: aaabhish is an unknown quantity at this point 
Solved Threads: 0
aaabhish aaabhish is offline Offline
Newbie Poster

Re: vector of string

 
0
  #6
Nov 15th, 2007
when we are saying vector dimention is it the memory offsets or memory segments. i have a confusion in such things.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: vector of string

 
0
  #7
Nov 15th, 2007
So maybe in C,
  1. struct vector_of_int {
  2. int *data;
  3. size_t allocatedSize;
  4. size_t maxUsedSize;
  5. };
Now create a bunch of access functions which take a vector_of_int as one of the parameters, and make it do things like
- allocate space
- extend space
- free space
- save an int
- return an int
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 9
Reputation: aaabhish is an unknown quantity at this point 
Solved Threads: 0
aaabhish aaabhish is offline Offline
Newbie Poster

Re: vector of string

 
0
  #8
Nov 18th, 2007
Originally Posted by Salem View Post
So maybe in C,
  1. struct vector_of_int {
  2. int *data;
  3. size_t allocatedSize;
  4. size_t maxUsedSize;
  5. };
Now create a bunch of access functions which take a vector_of_int as one of the parameters, and make it do things like
- allocate space
- extend space
- free space
- save an int
- return an int
here in this code what is size_t . is it something predefined datatype.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,348
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1462
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: vector of string

 
0
  #9
Nov 18th, 2007
>>what is size_t . is it something predefined datatype.
Yes -- most compiler define it as either long or unsigned long. But compilers are free to define it however it wants, uncluding long long
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC