| Dev-Spot Developer Forums |
|
September 05, 2010, 02:24:34 PM
|
|||
|
|||
| News: Welcome to the LearnCpp.com forums! Enjoy your stay. |
| Home | Help | Search | Login | Register |
|
1
on: Today at 12:15:40 PM
|
||
| Started by Amtty - Last post by Amtty | ||
|
Well i have read upto 4.7 as fast as i could i'm now on to the quiz there and have no idea, i had a look at the soultion get what everything means but what gets me is how it is laid out, and the order it goes in
|
||
|
2
on: September 04, 2010, 11:07:04 AM
|
||
| Started by Amtty - Last post by laserlight | ||
|
Keep going until you reach chapter 5. That's where you really need to review your grasp of the fundamentals, and then writing simple programs also gets more interesting
![]() |
||
|
3
on: September 04, 2010, 06:13:31 AM
|
||
| Started by Amtty - Last post by Amtty | ||
|
Only upto 2.4 haven't been on much due to partying :p
|
||
|
4
on: September 03, 2010, 04:01:07 PM
|
||
| Started by xarzu - Last post by xarzu | ||
|
I have a question about referrals for my wordpress blog. This might be more of a PHP question than a wordpress question. After I manage to add the field to the sign-up page where the user can add a referral ID, how do I add the functionality where that referral ID can be inserted automatically in the sign-in page? I know that in PHP you can add strings at the end of a URL like?this or like?this=that but how does one make sure that this translates to a string being added to a field in the web page?
|
||
|
5
on: September 03, 2010, 11:25:25 AM
|
||
| Started by Amtty - Last post by laserlight | ||
|
Where are you at now?
|
||
|
6
Programming (all languages) / For Beginners / Re: How To dynamically allocate one part of a 2 dimensional array
on: September 03, 2010, 11:13:33 AM
|
||
| Started by drowdemon - Last post by laserlight | ||
|
Quote from: Pintsize But, that could only work if all the rows had the same size, wouldn't it? Not exactly, but yes, a matrix structure is typically the case when people want a dynamic array of dynamic arrays, rather than thinking in terms of a dynamic array of objects in which the objects themselves might each contain a dynamic array. For jagged multidimensional dynamic arrays, this is not always feasible.Quote from: Pintsize What would happen if I wanted to just allocate the necessary memory for the lenght of names? It may still be feasible to just allocate one huge array if you know the total number of chars needed in advance (e.g., you make two passes over a file that you are reading from). On the other hand, it may be easier to just accept the many allocations and use a std::vector<std::string>.Quote from: drowdemon I surprised myself by figuring out how to access the array properly! Good to hear that ![]() |
||
|
7
Programming (all languages) / For Beginners / Re: How To dynamically allocate one part of a 2 dimensional array
on: September 03, 2010, 07:30:45 AM
|
||
| Started by drowdemon - Last post by drowdemon | ||
|
Thanks so much laserlight
Your method works, and I surprised myself by figuring out how to access the array properly! |
||
|
8
Programming (all languages) / For Beginners / Re: How To dynamically allocate one part of a 2 dimensional array
on: September 03, 2010, 05:04:00 AM
|
||
| Started by drowdemon - Last post by Pintsize | ||
|
Quote Usually, it is better to create a single huge dynamic array of the desired elements, then create a dynamic array of pointers and set them to point at specific parts of the huge array. Once done, the huge dynamic array can be accessed as an array of arrays by accessing it through the array of pointers. But, that could only work if all the rows had the same size, wouldn't it? What would happen if I wanted to just allocate the necessary memory for the lenght of names? Code: 0 -> [a][l][e][x][\0] 1 -> [p][i][n][t][s][i][z][e][\0] 2 -> [l][a][s][e][r][l][i][g][h][t][\0] .. -> .. |
||
|
9
on: September 03, 2010, 03:37:55 AM
|
||
| Started by Amtty - Last post by Amtty | ||
|
Anyone got any ideas really needing some help here
|
||
|
10
Programming (all languages) / For Beginners / Re: How To dynamically allocate one part of a 2 dimensional array
on: September 03, 2010, 02:03:55 AM
|
||
| Started by drowdemon - Last post by laserlight | ||
|
Quote from: drowdemon How would I dynamically allocate one part of a two dimensional array. It appears that you want to have a dynamic array of arrays of 80 chars. The syntax is:Code: std::size_t size = 5; Typically, a typedef would be used to make it more readable, e.g.,char (*x)[80] = new char[size][80]; // ... delete[] x; Code: typedef char ArrayType[80]; std::size_t size = 5; ArrayType* x = new ArrayType[size]; // ... delete[] x; Pintsize's first example involves an array of 20 dynamic arrays of char, by using an array of 20 pointers to char. Pintsize's second example is a typically naive way to have a dynamic array of dynamic arrays. Usually, it is better to create a single huge dynamic array of the desired elements, then create a dynamic array of pointers and set them to point at specific parts of the huge array. Once done, the huge dynamic array can be accessed as an array of arrays by accessing it through the array of pointers. |
||