473,387 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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& str3) {

char* ppsz_arg2[] = new char[3]; // how can I allocate memory for the
array of char* here?
ppsz_arg2[0] = str1.c_str();
ppsz_arg2[1] = str2.c_str();
ppsz_arg2[2] = str3.c_str();

Thank you for any help.

Jun 10 '07 #1
20 7068
si***************@gmail.com wrote:
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& str3) {

char* ppsz_arg2[] = new char[3]; // how can I allocate memory for the
array of char* here?
Here you're allocating an array of 3 chars. You want to instead
allocate an array of 3 *pointers* to const chars.
ppsz_arg2[0] = str1.c_str();
ppsz_arg2[1] = str2.c_str();
ppsz_arg2[2] = str3.c_str();
Best way by far to do this is use std::vector.

std::vector<const char *> vec( 3 );

vec[0] = str1.c_str();
vec[1] = str2.c_str();
vec[2] = str3.c_str();

Now you don't have probs will freeing the memory afterwoods.

BTW - anything that modifies str1, str2 and str3 will invalidate the
pointers placed in the vector so make sure they are never touched while
you're using vec.
Jun 11 '07 #2
On Jun 10, 7:03 pm, Gianni Mariani <gi3nos...@mariani.wswrote:
silverburgh.me...@gmail.com wrote:
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& str3) {
char* ppsz_arg2[] = new char[3]; // how can I allocate memory for the
array of char* here?

Here you're allocating an array of 3 chars. You want to instead
allocate an array of 3 *pointers* to const chars.
ppsz_arg2[0] = str1.c_str();
ppsz_arg2[1] = str2.c_str();
ppsz_arg2[2] = str3.c_str();

Best way by far to do this is use std::vector.

std::vector<const char *vec( 3 );

vec[0] = str1.c_str();
vec[1] = str2.c_str();
vec[2] = str3.c_str();

Now you don't have probs will freeing the memory afterwoods.

BTW - anything that modifies str1, str2 and str3 will invalidate the
pointers placed in the vector so make sure they are never touched while
you're using vec.
Thanks. But I need to call a function which takes 'char* ppsz_arg2[]'
later on.

How can I convert from 'std::vector<const char *>' to 'char*
ppsz_arg2[]'?

Thanks for any other pointers.
Jun 11 '07 #3

<si***************@gmail.comwrote in message ...
On Jun 10, 7:03 pm, Gianni Mariani <gi3nos...@mariani.wswrote:
silverburgh.me...@gmail.com wrote:
In my code, I have an array of char* pointer which is populated
statically:
void function1() {
char *ppsz_argv2[] = { "abc", "def", "dummy"};
//...
}
Best way by far to do this is use std::vector.

std::vector<const char *vec( 3 );
vec[0] = str1.c_str();
vec[1] = str2.c_str();
vec[2] = str3.c_str();

Now you don't have probs will freeing the memory afterwoods.
BTW - anything that modifies str1, str2 and str3 will invalidate the
pointers placed in the vector so make sure they are never touched while
you're using vec.

Thanks. But I need to call a function which takes 'char* ppsz_arg2[]'
later on.
How can I convert from 'std::vector<const char *>' to 'char*
ppsz_arg2[]'?
Thanks for any other pointers.
void CharFunc( char const *arg[], std::size_t size ){
return;
}

{
std::vector< char const * Vppsz(3);
// .... fill vector
CharFunc( &Vppsz.at(0), Vppsz.size() );
}

Or, even better, change to:

void CharFunc( std::vector< char const *const &ppsz ){
return;
}

{
std::vector< char const * Vppsz(3);
// .... fill vector
CharFunc( Vppsz );
}

Best yet:

void CharFunc( std::vector< std::string /*const*/ &ppsz ){
return;
}

{
std::vector< std::string Vppsz(3);
// .... fill vector
CharFunc( Vppsz );
}

--
Bob R
POVrookie
Jun 11 '07 #4
On Jun 10, 10:01 pm, "BobR" <removeBadB...@worldnet.att.netwrote:
<silverburgh.me...@gmail.comwrote in message ...
On Jun 10, 7:03 pm, Gianni Mariani <gi3nos...@mariani.wswrote:
silverburgh.me...@gmail.com wrote:
In my code, I have an array of char* pointer which is populated
statically:
void function1() {
char *ppsz_argv2[] = { "abc", "def", "dummy"};
//...
}
Best way by far to do this is use std::vector.
std::vector<const char *vec( 3 );
vec[0] = str1.c_str();
vec[1] = str2.c_str();
vec[2] = str3.c_str();
Now you don't have probs will freeing the memory afterwoods.
BTW - anything that modifies str1, str2 and str3 will invalidate the
pointers placed in the vector so make sure they are never touched while
you're using vec.
Thanks. But I need to call a function which takes 'char* ppsz_arg2[]'
later on.
How can I convert from 'std::vector<const char *>' to 'char*
ppsz_arg2[]'?
Thanks for any other pointers.

void CharFunc( char const *arg[], std::size_t size ){
return;
}

{
std::vector< char const * Vppsz(3);
// .... fill vector
CharFunc( &Vppsz.at(0), Vppsz.size() );

}

Or, even better, change to:

void CharFunc( std::vector< char const *const &ppsz ){
return;
}

{
std::vector< char const * Vppsz(3);
// .... fill vector
CharFunc( Vppsz );

}

Best yet:

void CharFunc( std::vector< std::string /*const*/ &ppsz ){
return;
}

{
std::vector< std::string Vppsz(3);
// .... fill vector
CharFunc( Vppsz );

}

--
Bob R
POVrookie
Thanks. I get garabage when I try to print out arg[] in my CharFunc():

void CharFunc( char const *arg[], std::size_t size ){

// when I print out the content of arg[] here, I get garbage for
arg[1] (just arg[1])
return;
}

void anotherFun(string& str){
{

std::ostringstream apath;
apath << "http://";

apath << str;

apath << '\0';

std::vector< const * Vppsz(3);
vec[0] = "abc";
vec[1] = (char*)apath.str().c_str();
vec[2] = "hello";

CharFunc( &Vppsz.at(0), Vppsz.size() );

}

Can you please tell me why is that? Thank you

Jun 11 '07 #5

"Silverburgh Meryl" wrote:
void function1(string& str1, string& str2, string& str3)
{
// how can I allocate memory for the array of char* here?
char* ppsz_arg2[] = new char[3];
...
}
Why do you need dynamic allocation if the number of elements
is always three?

If you're *sure* you need dynamic allocation for the array,
then allocate more array space than you think you'll need.
(If you run out of space, you'll have to re-allocate, which
will get very messy.)

Your syntax has multiple errors, though. It should look
more like this:

// new-array-test.cpp
#include <iostream>
#include <string>
#include <cstring>
#include <new>

void
function1
(
std::string const & str1,
std::string const & str2,
std::string const & str3
)
{
char ** ppsz_arg2 = new char* [50];

ppsz_arg2[0] = new char [str1.size() + 1];
std::strcpy(ppsz_arg2[0], str1.c_str());

ppsz_arg2[1] = new char [str2.size() + 1];
std::strcpy(ppsz_arg2[1], str2.c_str());

ppsz_arg2[2] = new char [str3.size() + 1];
std::strcpy(ppsz_arg2[2], str3.c_str());

std::cout << "First string is: " << ppsz_arg2[0] << std::endl;
std::cout << "Second string is: " << ppsz_arg2[1] << std::endl;
std::cout << "Third string is: " << ppsz_arg2[2] << std::endl;
return;
}

int main (int, char * Luthien[])
{
function1(Luthien[1], Luthien[2], Luthien[3]);
return 0;
}

If I then type, at the command prompt:

new-array-test Able Baker Charly

It prints:

First string is: Able
Second string is: Baker
Third string is: Charly

But if you're only going to have 3 elements, you should
use a static array.

Replace this line:

char ** ppsz_arg2 = new char* [50];
with this line:

char *ppsz_arg2[3];
(Better yet, dump all usage of C-style char* and use
std::string instead, throughout your program. It's
sooooooo much easier.)
--
Cheers,
Robbie Hatley
lonewolf aatt well dott com
triple-dubya dott tustinfreezone dott org
Jun 11 '07 #6
si***************@gmail.com wrote:
....
Can you please tell me why is that? Thank you
Please post exactly the code you're using to demonstrate the errors
because the code you posted in your last post won't compile.

Also, make sure you don't touch the string after placing it in the
vector and the vector has yet to be destroyed.

Jun 11 '07 #7

<si***************@gmail.comwrote in message ...
Thanks. I get garabage when I try to print out arg[] in my CharFunc():

void CharFunc( char const *arg[], std::size_t size ){
// when I print out the content of arg[] here, I get garbage for
arg[1] (just arg[1])
return;
}

void anotherFun(string& str){ {
std::ostringstream apath;
apath << "http://";
apath << str;
apath << '\0';
std::vector< const * Vppsz(3);
vec[0] = "abc";
vec[1] = (char*)apath.str().c_str();
vec[2] = "hello";
CharFunc( &Vppsz.at(0), Vppsz.size() );
}

Can you please tell me why is that? Thank you
You need to put something *in* the vector!!!

#include <iostream>
#include <vector>
#include <ostream>

void CharFunc( char const *arg[], std::size_t size,
std::ostream &out ){
for( std::size_t i(0); i < size; ++i ){
out<<arg[i]<<std::endl;
}
return;
}

int main(){ using std::cout; // for NG post

std::vector< char const *Vppsz(3);
Vppsz.at(0) = "abc"; // NOT vec[]
Vppsz.at(1) = "def";
Vppsz.at(2) = "dummy";
CharFunc( &Vppsz.at(0), Vppsz.size(), cout );
return 0;
} // main()

Note how I have posted a *complete*, compilable program, which demonstrates
a problem (if there were one, in which case I would also post the first 3 or
4 errors). That's how you should post in this NG.

When you post little bits of here and there code, it's hard to determine
exactly what errors you are getting (and/or why).

--
Bob R
POVrookie
Jun 11 '07 #8

.... additional ...
<si***************@gmail.comwrote in message ...
void anotherFun(string& str){ {
std::ostringstream apath;
apath << "http://";
apath << str;
apath << '\0';
Learn to use std::string.....

std::string apath( "http://" );
apath += str;
// apath += '\0'; // not needed, use 'apath.c_str()'
Now look how easy it is with std:string...
#include <iostream>
#include <vector>
#include <ostream>
#include <string>

void FillVector( std::vector< std::string &vec){ // non-const here
vec.push_back( "abc" );
vec.push_back( "def" );
vec.push_back( "dummy" );
return;
} // FillVector(vector<string>&)

void PrintVector( std::vector< std::string const &vec,
std::ostream &out ){
for( std::size_t i(0); i < vec.size(); ++i ){ // vector has the size
out<<vec.at( i )<<std::endl;
// out<<vec.[ i ]<<std::endl; // ok here, index is safe
} // for(i)
return;
} // PrintVector(vector<string>const&,ostream &)
int main(){ using std::cout; // for NG post
std::vector< std::string MyVec;
FillVector( MyVec );
PrintVector( MyVec, cout );
return 0;
} // main()
--
Bob R
POVrookie
Jun 11 '07 #9
On Jun 11, 1:55 pm, "BobR" <removeBadB...@worldnet.att.netwrote:
... additional ...
<silverburgh.me...@gmail.comwrote in message ...
void anotherFun(string& str){ {
std::ostringstream apath;
apath << "http://";
apath << str;
apath << '\0';

Learn to use std::string.....

std::string apath( "http://" );
apath += str;
// apath += '\0'; // not needed, use 'apath.c_str()'

Now look how easy it is with std:string...
#include <iostream>
#include <vector>
#include <ostream>

#include <string>

void FillVector( std::vector< std::string &vec){ // non-const here
vec.push_back( "abc" );
vec.push_back( "def" );
vec.push_back( "dummy" );
return;
} // FillVector(vector<string>&)

void PrintVector( std::vector< std::string const &vec,
std::ostream &out ){
for( std::size_t i(0); i < vec.size(); ++i ){ // vector has the size
out<<vec.at( i )<<std::endl;
// out<<vec.[ i ]<<std::endl; // ok here, index is safe
} // for(i)
return;
} // PrintVector(vector<string>const&,ostream &)
int main(){ using std::cout; // for NG post

std::vector< std::string MyVec;
FillVector( MyVec );
PrintVector( MyVec, cout );
return 0;
} // main()

--
Bob R
POVrookie
Bob,

Thank you very much for your help. i have one more question:
void FillVector( std::vector< std::string &vec){
vec.push_back( "abc" );
vec.push_back( "def" );
vec.push_back( "dummy" );

}

Where does these string "abc", "def", "dummy" allocated? Stack or
heap?
And do i need to call destructor for those strings?

Thank you.
Jun 11 '07 #10

<si***************@gmail.comwrote in message ...
On Jun 11, 1:55 pm, "BobR" wrote:
... additional ...
[snip]
Learn to use std::string.....
Now look how easy it is with std:string...
#include <iostream>
#include <vector>
#include <ostream>
#include <string>

void FillVector( std::vector< std::string &vec){ // non-const here
vec.push_back( "abc" );
vec.push_back( "def" );
vec.push_back( "dummy" );
return;
} // FillVector(vector<string>&)

void PrintVector( std::vector< std::string const &vec,
std::ostream &out ){
for( std::size_t i(0); i < vec.size(); ++i ){ // vector has the
size
out<<vec.at( i )<<std::endl;
// out<<vec.[ i ]<<std::endl; // ok here, index is safe
} // for(i)
return;
} // PrintVector(vector<string>const&,ostream &)
int main(){ using std::cout; // for NG post
std::vector< std::string MyVec;
FillVector( MyVec );
PrintVector( MyVec, cout );
return 0;
} // main()
POVrookie
Bob,
Please do not quote sigs (the '--'), it messes with some newsreaders.
Thanks.
>
Thank you very much for your help. i have one more question:
void FillVector( std::vector< std::string &vec){
vec.push_back( "abc" );
vec.push_back( "def" );
vec.push_back( "dummy" );
}

Where does these string "abc", "def", "dummy" allocated? Stack or
heap?
It's copied directly[1] into the string in the vector. As long as the vector
is alive, the strings are alive. You can modify the strings in the vector:

// using the 'vec' in 'FillVector()' function
vec.at( 1 ) = "Hello";
vec.at( 1 ) += "World!";
std::string tmp(" I want to be the leader of the ");
vec.at( 0 ) = tmp;
vec.at( 0 ) += "World!";
if( vec.at( 2 ).size() < 10 ){
vec.at( 2 ) = std::string( 20, '*' );
}
.... etc.

And do i need to call destructor for those strings?
No. When the vector gets destructed, it calls the destructors of all the
elements in it. Neat, eh? No messing with new/delete, etc., the string
handles it's data, and the vector handles it's data ( the strings).

[1] - it's a little more complex than that, but, for now, that's all you
need.
--
Bob R
POVrookie
Jun 11 '07 #11
BobR <re***********@worldnet.att.netwrote:
Please do not quote sigs (the '--'), it messes with some newsreaders.
It should be "-- \n" (note the space before the newline). As such, your
sig delimiter is missing the space.

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Jun 12 '07 #12

Marcus Kwok <ri******@gehennom.invalidwrote in message...
BobR <re***********@worldnet.att.netwrote:
Please do not quote sigs (the '--'), it messes with some newsreaders.

It should be "-- \n" (note the space before the newline). As such, your
sig delimiter is missing the space.
Ya know, I've never had any trouble with 'sig quoting', either on windows or
GNU/Linux mail/newsreaders. I was told not to put 'code' below my sig, as it
doesn't show in some readers ( it was some joke code).
But, WHAT newsreader(s)? If it's just one single newsreader, shouldn't the
distributor be contacted to correct it, instead of us asking posters not to
quote sigs?

OK, rant over.
Thanks for the correction.

--
Bob R
POVrookie
Jun 12 '07 #13
BobR <re***********@worldnet.att.netwrote:
Marcus Kwok <ri******@gehennom.invalidwrote in message...
>BobR <re***********@worldnet.att.netwrote:
Please do not quote sigs (the '--'), it messes with some newsreaders.

It should be "-- \n" (note the space before the newline). As such, your
sig delimiter is missing the space.

Ya know, I've never had any trouble with 'sig quoting', either on windows or
GNU/Linux mail/newsreaders.
When the sig is properly delimited, my newsreader (tin) will
automatically strip the sig before I reply.

It seems you are using Outlook Express, which will strip blank spaces at
the ends of lines, and thus corrupt your sig delimiter. I do not know
if it has the option to turn this off.

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Jun 12 '07 #14

Marcus Kwok <ri******@gehennom.invalidwrote in message ...
BobR <re***********@worldnet.att.netwrote:
Ya know, I've never had any trouble with 'sig quoting', either on
windows or
GNU/Linux mail/newsreaders.

When the sig is properly delimited, my newsreader (tin) will
automatically strip the sig before I reply.

It seems you are using Outlook Express,
correction - I'm using an *old* OE. <G>
which will strip blank spaces at
the ends of lines, and thus corrupt your sig delimiter. I do not know
if it has the option to turn this off.
Have not found one (.. but, I didn't really look for it.).

OE does what I need, except it puts 'PGP' signed stuff as an attachment (in
some NGs), just a blank body. ;-{

--
Bob R
POVrookie
Jun 12 '07 #15
BobR wrote:
Marcus Kwok <ri******@gehennom.invalidwrote in message ...
>BobR <re***********@worldnet.att.netwrote:
>>Ya know, I've never had any trouble with 'sig quoting', either on
windows or
>>GNU/Linux mail/newsreaders.
When the sig is properly delimited, my newsreader (tin) will
automatically strip the sig before I reply.

It seems you are using Outlook Express,

correction - I'm using an *old* OE. <G>
Oh yeah. Why?
>which will strip blank spaces at
the ends of lines, and thus corrupt your sig delimiter. I do not know
if it has the option to turn this off.

Have not found one (.. but, I didn't really look for it.).

OE does what I need, except it puts 'PGP' signed stuff as an attachment (in
some NGs), just a blank body. ;-{
There are people who call OE a newsreader.
There are also people who use macros and call them templates :-)

--
Thomas
http://www.netmeister.org/news/learn2quote.html
Jun 12 '07 #16

Thomas J. Gritzan <Ph*************@gmx.dewrote in message...
BobR wrote:
Marcus Kwok <ri******@gehennom.invalidwrote in message ...
It seems you are using Outlook Express,
correction - I'm using an *old* OE. <G>

Oh yeah. Why?
Using win98se.
( ...and NO, I will not PAY for any newer ms products. Go GNU! )
>
There are people who call OE a newsreader.
Did I do that? I'll have to go wash my mouth out with soap.
There are also people who use macros and call them templates :-)
Not me, I hate macros[1]! <G>

[1] - other than include-guards, or compile 'directives' (#if, #else,
#endif).
--
Bob R
POVrookie
Jun 12 '07 #17
On Jun 12, 4:38 pm, ricec...@gehennom.invalid (Marcus Kwok) wrote:
BobR <removeBadB...@worldnet.att.netwrote:
Please do not quote sigs (the '--'), it messes with some newsreaders.
It should be "-- \n" (note the space before the newline). As
such, your sig delimiter is missing the space.
Note that Google messes this up sometimes. I've tried on my own
postings: the space is present in the message as it appears, but
when you hit the reply button, it gets stripped, and the sig
remains.

IMHO, this is (or should not be) a major problem. You edit the
posting you are replying to anyway, to remove the unnecessary
parts. The sig is just one more unnecessary part which needs
removing.

--
James Kanze (GABI Software, from CAI) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Jun 13 '07 #18
James Kanze <ja*********@gmail.comwrote:
On Jun 12, 4:38 pm, ricec...@gehennom.invalid (Marcus Kwok) wrote:
>BobR <removeBadB...@worldnet.att.netwrote:
Please do not quote sigs (the '--'), it messes with some newsreaders.
>It should be "-- \n" (note the space before the newline). As
such, your sig delimiter is missing the space.

Note that Google messes this up sometimes. I've tried on my own
postings: the space is present in the message as it appears, but
when you hit the reply button, it gets stripped, and the sig
remains.
Yes, I've seen your posts about it in the past and I know you've
earnestly tried very hard to figure out where the problem is. It is
unfortunate that Google gets this wrong (if it is indeed caused by the
Google chain of posting).

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Jun 13 '07 #19
BobR wrote:
Thomas J. Gritzan <Ph*************@gmx.dewrote in message...
>There are people who call OE a newsreader.

Did I do that? I'll have to go wash my mouth out with soap.
No, but why using it then?
I switched from OE to Thunderbird some time ago and I found that they are
used quite equally. But without the bugs.
>There are also people who use macros and call them templates :-)

Not me, I hate macros[1]! <G>
I was refering to another thread about "C++ templates" and "macro templates".
[1] - other than include-guards, or compile 'directives' (#if, #else,
#endif).
Valid usage.
--
Bob R
POVrookie
Your signature delimiter is broken, too.

--
Thomas
http://www.netmeister.org/news/learn2quote.html
Jun 13 '07 #20
On Jun 13, 3:45 pm, ricec...@gehennom.invalid (Marcus Kwok) wrote:
James Kanze <james.ka...@gmail.comwrote:
On Jun 12, 4:38 pm, ricec...@gehennom.invalid (Marcus Kwok) wrote:
BobR <removeBadB...@worldnet.att.netwrote:
Please do not quote sigs (the '--'), it messes with some newsreaders.
It should be "-- \n" (note the space before the newline). As
such, your sig delimiter is missing the space.
Note that Google messes this up sometimes. I've tried on my own
postings: the space is present in the message as it appears, but
when you hit the reply button, it gets stripped, and the sig
remains.
Yes, I've seen your posts about it in the past and I know you've
earnestly tried very hard to figure out where the problem is. It is
unfortunate that Google gets this wrong (if it is indeed caused by the
Google chain of posting).
At least one small part is, since the posting which appears is
correct; it only gets mangled when you click on the reply
button, and it gets mangled the same way regardless of where I'm
posting from. I've sent them an error report.

Another part is probable somewhere in the chain where I work,
perhaps the firewall. Apparently, somewhere along the line
something tries to convert my postings to US ASCII, which
doesn't work too well, given that they aren't US ASCII.

--
James Kanze (Gabi Software) email: ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Jun 13 '07 #21

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
1
by: Sam | last post by:
Hello all I have a two dimensional array (the dimensions are not known) that needs to be passed to fortran from c++, allocate the dimensions of the array in fortran code, do some filling up of...
4
by: songkv | last post by:
Hi, I am trying to reassign an array of char to a string literal by calling a function. In the function I use pointer-to-pointer since I want to reassign the "string array pointer" to the string...
18
by: Vijay Kumar R Zanvar | last post by:
Hi c.l.c, Is this a correct method of allocating a 3-dimensional array? /* assume all malloc's succeed */ #define MAT 2 #define ROW 2 #define COL 2
5
by: pandapower | last post by:
Hi, I know about the equivalence of pointer and arrays.But my doubt comes when its for multidimentional arrays.I have read the C faq but still have some doubts. Suppose I have a declaration as...
4
by: Simon Schaap | last post by:
Hello, I have encountered a strange problem and I hope you can help me to understand it. What I want to do is to pass an array of chars to a function that will split it up (on every location where...
14
by: Gattaca | last post by:
I would like to create a matrix of integers by allocating memory dynamically (malloc or calloc) because i and j are defined during execution of the program. I have got not problem to do this in...
204
by: Alexei A. Frounze | last post by:
Hi all, I have a question regarding the gcc behavior (gcc version 3.3.4). On the following test program it emits a warning: #include <stdio.h> int aInt2 = {0,1,2,4,9,16}; int aInt3 =...
11
by: Zordiac | last post by:
How do I dynamically populate a string array? I hope there is something obvious that I'm missing here Option Strict On dim s() as string dim sTmp as string = "test" dim i as integer ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.