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.
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.
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.
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.
Listen to Salem. C does not have a vector anything. Nor does it have generic anything. Those are both C++ constructs.
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.
when we are saying vector dimention is it the memory offsets or memory segments. i have a confusion in such things.
So maybe in C,
struct vector_of_int {
int *data;
size_t allocatedSize;
size_t maxUsedSize;
};
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
So maybe in C,
struct vector_of_int { int *data; size_t allocatedSize; size_t maxUsedSize; };
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.
>>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
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.