Hello hammer,
Thank you for your reply. You seem to have used malloc and I have used calloc ... Other than that I use the same sematics you use ... the only differences I see are -->
...
Type: Posts; User: Saravanan
Hello hammer,
Thank you for your reply. You seem to have used malloc and I have used calloc ... Other than that I use the same sematics you use ... the only differences I see are -->
...
I use two callocs ... one to allocate the space for the pointers that hold the actual data and one to allocate the actual data.
for (i = 0; i < 10; i++)
{
pSections[i] =...
The reason I dont use what you just described is because I already have all of these entries allocated as a result of other code. I just need to hold the pointers. So look at it this way -->
...
I am allocating space for the 2nd dimension in the array and not the structure. So I think it should be sizeof(MyStruct *) ... right? Please let me know if I assume correct.
I am trying to allocate memory for a structure that looks like this.
typedef struct
{
int nID;
char ** pMessage;
} MyStruct;
Hi folks,
Thank you for the reply, Salem. I have a compile problem now pertaining to the same issue. Why cant I do the following
struct A
{
int a;
A * ptr[];
Hi orbitz,
Thanks for that response.
Actually I am not trying to implement a linked list. There are two seperate structures (A and B are actually a whole lot different) and the idea is that...
Hello all,
I have a question about arrays of variable length. This is what I would like to do. I have two structures A and B
struct A
{
int a;
int b;
struct A * pSubA;
};
Folks,
I think I got it ...
I needed to place the union defenition like this -->
struct bits
{
unsigned long d : 12
unsigned long c : 12
unsinged long b : 5
Thanks for this discussion folks. Let me restate my problem so that there is clarity.
I want to define a structure that will retreive the meaning of the char array into member variables. The meaning...
When you say drastically change the structure, do you mean the sizes also ... because I am ok to changing the structures ... This structure is local to my application. its only the char array that...
time_t time() will give you time passed since epoch which is 00:00:00 January 1 1970. To find out difference between two times, you need to create the time_t entries for both times and subtract the...
I use memcpy to copy between character arrays. I dont want to use the shifting route because that will mean that I need to know size of each data type. I prefer to change the structure itself so that...
I tried this out and it works great ... thanks ... But I have another request. Can I acheive the result to this problem without so many shifting operations by just reshuffling the order of members in...
Try using argv[1]. I am assuming that you use the following syntax to run your command
<your program name> filename.txt
argv[0] will give you the name of the executable itself. That is why you...