Can I predefine constant array in c? with constants i do #define NAMEOFCONST value.is it possible to do this for an array? And if not I would like to know why. I suspect it has to do with memory handeling and pointers.
I'm writing a PHP program. I've encountered a problem; in the following code I try to pass $_POST['delete'] which is an array as the value of a hidden input to some form, but it doesn't do so.there's something wrong with converting PHP array into HTML array. I'm sure that $_POST['delete'] is not null and is a real array.
(I am using vector() and matrix() functions from "Numerical recipes in C".)There are 100 numbers to be stored in 2D array of 10 rows and 10 columns.100 numbers are stored in a 1D array.I get "segmentation fault" at the line indicated in the segment of my code below:
I changed my post because I found that solution, and didn't want to bother for that. But, since I didnt find a way to delete the post, I thought of updating it: I am beginning to write the code for the philosophers problem. As you know, they can eat, think or wait for forks. When they have 2 forks, one by each side, they eat. Then they set the 2 forks as available, and think.
Each philosopher is a thread. My problem is that it gives segmentation fault, somehow, when I try to initialize. The thing I really don't understand, is why it sometimes gives segmentation fault on initialization #0!!! (But generally on initialization #1) I have set 5 initializations in total, defined by N, that is also the number of threads I'm working on.
I've just updated my linux system (Debian) and went to compile some code I'm working on. However it causes some problems, presumable because of GCC up dates. I get many of my subject line errors for example
../../common/Version_Control.cpp: In function int VersionControl(): ../../common/Version_Control.cpp:55: warning: deprecated conversion from string constant to char*
So I check up the error and it comes from my error handler code which is a function
I looked on the net for such function or example and didin't find anything, thus after having made one i guess it would be legitimate to drop it to see what others thinks of it.
#!/bin/bash addelementtoarray() { local arrayname=$1
This array is supposed to contain 12 elements (names of the month) What I want to achieve is that depending on some user input (a number 1-12) a full name of one of the months will be displayed, eg.
Code: scanf("%d", &month); printf("The month is %c", months_names[month]);
I have a text file from which i read a number of names with their lengths at the run-time.Now i want to created a char array having the length and name as already read from the text file at the run-time. There is no compilation involved. Every thing is happening at the run-time. I tried using STL like map along with malloc but i am unable to name an array at run-time. I can keep some type of mapping with previously created arrays
I manage to write apr4sens into file,works fine.But how to write it into array,which I could later reshape and so on. I tryied like this group=apr4sens. It doesn't work.
i have a loop which produces new value everytime it runs. i want to store the results in an array. how can i do dat??
loop is like: a=0 declare v while ((....)) do v[$a]="$r" let a=a+1 done
while doing this it is not treating v as array but as variable and it is overriding the value and old value is lost..i am using bash shell version 3.00.15
$1 is an argument which is actually and array. In function we want to assign a value 0 of it's first content. But it's wrong way. Anybody know the right way to assign value in function by passing as argument.
I believe I have unwanted ' characters left in a 9 element character array that are causing subsequent operations with it to fail. I see wildly differing views on the web on the proper way to flush 'em. It's clearly not as simple as it would appear at first sight. What's currently the best (or else "least deprecated") method?
The idea is to make a website to check the availability of domains and it works but its not pretty yet. Below is what i have till so far:
## this is the API from my domain registrar. <?php $client = new SoapClient('http://api.sync.com/?wsdl'); ## I have a search box that sends the request to this page $var = $_GET ["s"];
## remove the most common subdomains from the request. $var=eregi_replace("www.", "", $var); $var=eregi_replace("mail.", "", $var); $var=eregi_replace("ftp.", "", $var); $var=eregi_replace("pop.", "", $var); $var=eregi_replace("smtp.", "", $var);
## remove any TLD extension from the request. $split = explode(".", $var); $main = $split[0]; $arraysize = sizeof($split); for ($x=1; $x<$arraysize; $x++) { $tld .= "." . $split[$x]; } ## login to the API $paramLogin = array('handle' => 'randall', 'password' => 'password');
Result Login: Array ( [code] => 200 [message] => Login succesful ) array(3) { ["code"]=> string(3) "200" ["message"]=> string(20) "Domain not available" ["result"]=> object(stdClass)#236 (1) { ["status"]=> string(5) "TAKEN" } } bool(true) array(3) { ["code"]=> string(3) "200" ["message"]=> string(16) "Domain available" ["result"]=> object(stdClass)#232 (1) { ["status"]=> string(4) "FREE" } } bool(true) ?> ## till so far it works
What I need to do is to make this ugly looking reply in to something more readable, basically if TAKEN print occupied and if free print its yours to grab. I have been struggling with the in_array function but i'm not getting anywhere close in getting it to work.
I was thinking about how to make a dynamic array in C, and I thought that it would be much better if it could accept any data type. Is this possible? Of course I thought about void pointers, but how do I store the actual data?
I'm trying access binary records that were created in Borland Delphi and stored in a SQL Server database (as a BLOB). What the heck is the syntax for accessing a two-D array in C#? Here's an example:
Code:
const MAX_BOWLERS = 8; gMAX_FRAMES = 40; ... type
[code]...
I've successfully got a valid "GameRec" over to C#-land. I want to access array element "GameRec.Frames[iBowler, iFrame]".
How do I define a C# type "TFrames = Array[1..Max_Bowlers, 0..gMax_Frames] of TFrame;" so that I can do it?
I have never used multidimensional array for a long time so please consider this as a newbie question. I am editing a program that uses a 4 dimensional array and I think I'm losing track of the indexes.
day = 0 to 30 hour = 0 to 23 channel = 0 to 7 len = 0 to 63 unsigned char idx[day][channel][hour][len];
I have seen that the assignment to a string is snprintf(idx[day][hour][channel], 64, "%s/%s", dayofmonth, hourofday); Is this correct? Because when I access with a day argument, that day value goes into the hour part.
I would like to know how can I find array length in C .I have array of structure and I want to sent it to different functions and I want to have it's length (number of elements) each time I want to use it and I don't like to use any additional variable to pass the function for each of arrays that I pass to function. How can I do that?