How to populate an array of char* pointer dymanically?


In my code, I have an array of char* pointer which is populated statically: void function1() { char *ppsz_argv2[] = { "abc" , "def", "dummy"}; //... } But how can I populated it dynamically void function1(string& str1, string& str2, string& ...
Posted On: Monday 26th of November 2012 12:47:33 AM Total Views:  223
View Complete with Replies

RELATED TOPICS OF C Language PROGRAMMING LANGUAGE




Ideal way to return a member array

What might the best way be to return a member variable array (Except using std::vector ) class A { public: // one possible way; but size info is lost const int* const getArrAsPtr() { return arr; } // Copy ...
VIEWS ON THIS POST

167

Posted on:

Sunday 25th November 2012
View Replies!

size of array is not an integral constant-expression

#include using namespace std; template int foo(Iter first, Iter last, int nn) { const size_t n = last - first; double buf[n]; return 0; } int main(int argc, char **argv) { vector x; foo(x.begin(), x.end(), argc); return ...
VIEWS ON THIS POST

80

Posted on:

Sunday 25th November 2012
View Replies!

declaring constant array without initializing all the elements

I need to create a consant array of larze size but however its elements can be calculated using an equation, say for example I need an int arry of 20 elements where each element will be arr[i] = 2 ...
VIEWS ON THIS POST

120

Posted on:

Sunday 25th November 2012
View Replies!

forcing char array to act as int array

, I am trying to 'force' a character array to act as an int array. I want to use 4 chars to store an actual int , in the array, not a number converted to a string. So every 4 ...
VIEWS ON THIS POST

91

Posted on:

Sunday 25th November 2012
View Replies!

How to find number of times certain conditions happened in an array?

Dear , I would like to implement a function that computes the number of times a certain condition is met in a global array. For example, I have an global array of size 500. float array[500]; I have a function ...
VIEWS ON THIS POST

62

Posted on:

Sunday 25th November 2012
View Replies!

Using array variables as a non-type template arguments

I need a template class taking several non-type arguments. Then I want to be able to pass these arguments to the constructor of another non- template class. So far I have this (I did some editing to simplify the ...
VIEWS ON THIS POST

141

Posted on:

Sunday 25th November 2012
View Replies!

5GB array.

, How can I instantiate a 5GB array in BDS. Here is my code; /*Model*/ //-Checked 23-05-02 struct model{ int ijk; double xc; double yc; double zc; double xinc; double yinc; double zinc; int zone; int phase; int period; int ...
VIEWS ON THIS POST

89

Posted on:

Sunday 25th November 2012
View Replies!

Re: Sorting two arrays with one call to sort()?

{ Edits: Yahoo spam-like links removed from signature portion. Note 1: the quoted article by "xxx@gmail.com" doesn't appear to have been posted in clc++m, although the inner quoted article by John was. Note 2: Tom arken has the same e-mail ...
VIEWS ON THIS POST

141

Posted on:

Sunday 25th November 2012
View Replies!

Problem understanding pass by value and pass by reference of arrays and what happens in the memory

I have problem understanding pass by value and pass by reference and want to how how they are or appear in the memory: I had to get my basics right again. I create an array and try all possible ways ...
VIEWS ON THIS POST

122

Posted on:

Sunday 25th November 2012
View Replies!

hi,what is the meaning of int main(array ^args)

it just makes me feel confusing ... what does ^ mean , and how to use it .
VIEWS ON THIS POST

70

Posted on:

Sunday 25th November 2012
View Replies!

Inefficiency of dynamic string/array initialization

To the best of my knowledge there is no way for a C++ program to optimize initialization of dynamic strings so that a string literal isn't copied, e.g.: std::string s = "abc"; At the same time languages that support dynamic ...
VIEWS ON THIS POST

73

Posted on:

Sunday 25th November 2012
View Replies!

Making a vector init like and array

I want to put data in a vector but I don't want to do all that messy push back, I just want to add the data like an array but without all the limitations of an array. What is the ...
VIEWS ON THIS POST

62

Posted on:

Sunday 25th November 2012
View Replies!

map (associative array) loses values?

, I've never done this before, so I don't know about any layout possibilities. My apologies The problem is this: I've written a function: map *SearchText::countWords() { map *table = new map; (*table)["aap"] ...
VIEWS ON THIS POST

66

Posted on:

Sunday 25th November 2012
View Replies!

Alternatives to gigantic static array?

I need advice, please. I have a DLL that is used for looking up zip code data according to various criteria. I defined a struct for each data record, and built a static array, like this: typedef struct { char ...
VIEWS ON THIS POST

107

Posted on:

Sunday 25th November 2012
View Replies!

About the retrogression problem when passing a array variable into a function which takes a pointer as its argument.

folks, As the Subject suggests, array variable will retrogress as the parameter of the function actually taking pointer as its argument, like this: int f(int* i) { cout << sizeof(i) << endl; return 0; } main() { int a[100]; ...
VIEWS ON THIS POST

145

Posted on:

Monday 26th November 2012
View Replies!

Creating array of data types

Hi , I would like you help me in creating an array of data types. I am interested in look at the the data type which looks like this Array a[10]={int,float,char,int*..............................}, so that a[0] should return me int and a[1] ...
VIEWS ON THIS POST

102

Posted on:

Monday 26th November 2012
View Replies!

c char array assignment

, How do I assign value to a char array delcared as char tstring[16]; I want to do something like tstring = "blah\0"; I have done this and it works, but there must be a better way. tstring[0] = 'b'; ...
VIEWS ON THIS POST

105

Posted on:

Monday 26th November 2012
View Replies!

is a char array created in a function local?

, If a function that returns an array of char like this one: const char* f(){ return "abc"; } then is the char array "abc" local/temporary object I thought it should be temporary and hence the returned pointer should point ...
VIEWS ON THIS POST

143

Posted on:

Monday 26th November 2012
View Replies!

multi dimensional array

I need a class, that has a 4 dimensional array (can be 3 dimensional, too) with such an operator: T operator()(int x1, int x2=0, int x3=0, int x4=0); that can be used as: myarray(12); or myarray(12,14); depending on the ...
VIEWS ON THIS POST

114

Posted on:

Monday 26th November 2012
View Replies!

How to Convert a char array to int?

all, I'm new to C and I'm having a heck of a time trying to convert a char array element to an integer. Declaration of my char array is: char myarray[80]; ....then I scanf a number from the user ...
VIEWS ON THIS POST

277

Posted on:

Monday 26th November 2012
View Replies!