On the same platform you can do this.
Also you can have holes (padding) inside or at the end of structure. You still should be fine if you will read saved data back in the same structure and do not try to read value of one field based on shift.
I think char *text[][7] should work. 7 is the lenght of char in string, yes not a *text[][3][7] and
*text[][7] and text[][3][7] is the same in your case. the only difference in first case you can cheat compiler and ommit two dimensions.
char *text[][3] = ... in this case space got allocated but...
Your problem that you thought that your definition allocate space specificly for you strings, but it counting number of 2 dimensional arrays [3][3] and it 3, so you have array text[3][3][3].
In C you can not allocate array with different lenght of elements, if at least one string is 7 chars, all...
const char *text[3][3] = {
{ "Hello", "I'm", "the"},
{"sample", "char", "array"},
{ "and", "I'm", "mean"}
you have only [3] array for each of your string, so each string is no more...
Since we touched memset I want to add few words about this treaky function.
It's good for initiating strings with any character, but you also can use it on any array integer, double ... or on any chank of memory, just be carefull!!!
Somehow memset interface is missleading. Second argument...
General advises.
If you have function which allocate memory create another one to free it, like this:
double* getpolyfit(double* x,double* y,long order,long n)
void freepolyfit(double *a);
And always check pointer to NULL before calling free.
Better write own myFree(void *p); function which...
When you use precompiled headers (for example MS C++, and HP aCC support it) you don't compile it directly anyway. You still have to create .c file and include your common header file and then compile it. But I am agree it's not a normal object file since there will be only empty declarations...
Generally you should not compile any header files even user writen. Of cause you can put function implementation in header file and then you have to compile it, but this is WRONG design and you will not be able to include this file anywere, cause you will have double function difinitions during...
Yep,
It was broken make on HP. If I am building in deep directory (a lot of subdirectories) what is common for java modules and I have suffix rules it brakes make.
I used workaround calling "make -r" to ignore suffix rulles.
I even installed lates make patch - did not helped.
Thnaks.
One more.
Pid 9389 rceived a SISEGV fo sack grow faire.
ossibe aue: isfcet eory o swap space,
or stac size exceeded assiz.
Memory fault(coredump)
Looks like something really broken.
Any idea what can it be?
This is happanning on two different HP-UX 11 boxes.
Ok, I got htis error on HP-UX 11, from make file:
--------------
Pid 2692 receive aSGSEGV or stac gothfilre.
Posiecaue: nsufcit meoyor saspac,
or tacszeexcededmaxsi.
--------------
What is that?????? Some kind of slang?
The problem - I don't need all files from this directory, I am making back up, so I need only files which changed and that why I am creating this list before archiving.
HP-UX 11.
I have list of files I want to tar, they all in one directory, so I do next :
cat archives/9/9.filelist_exec_NT40_INTEL.win32|xargs tar cvf mytar.tarit
it prints:
a projbin/NT40_INTEL.win32/file1 5 blocks
a projbin/NT40_INTEL.win32/file2 258 blocks
....
all files frommy list.
The...
double value1[i];
double value2 [i][j];
double *p1 = value1; <- pointer to double.
double *(p2)[j] = value2; <- pointer to array of j doubles;
Now the difference:
p1+1 -> will make a shift in memory to size of one double and we will have pointer to second element of array
value1[1].
p2+1 will...
Looks fine.
May be some platforms have problem with:
float sum; Try it make double sum;
Also intsum = (int)sum;
and most important:
if ((sum - (double)intsum) == 0.)
If it will not help post yours output.
Funny about int a[10]; that
a,&a[0] and &a will have the same value if you pass it as function argument.
rbobbit right, 'a' is not a simple pointer. For example &a is not a double pointer, it's still single. Compiler will ignore '&' for 'a'.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.