A DB is one option. But what I had in mind was dynamically creating and destroying structs.
Can someone point me in the right direction? I just don't know where to start.
Thanks
Type: Posts; User: beginner.c
A DB is one option. But what I had in mind was dynamically creating and destroying structs.
Can someone point me in the right direction? I just don't know where to start.
Thanks
This does not compile, but what I'm trying to achieve is the ability to create a struct named "nn1" or any other name I choose at any point in my app.
Can anybody help?
#include <stdio.h>...
Is this what prelude is saying here
struct Node *make_node ( void )
{
struct Node new_node = malloc ( sizeof *new_node );
/* Error check and set a default state */
return new_node;
Thanks for the replies. More to the point, see my latest post...
I need to create an unknown number of structs in my application. Does anybody have any recommendations on doing this? I can easily do this inside a function, but then the struct I create inside that...
is this code valid?
where intA is 0 - will this create a new structure called newStruct1?
struct appA newStruct[intA + 1];
Got it thanks to
http://cboard.cprogramming.com/archive/index.php/t-5569.html
#include <stdio.h>
#include <stdlib.h>
struct foo {
Thanks for the response, I figured that would be the case. But how do I pass a struct as a pointer?
Hi,
I have the example code:
#include <stdio.h>
#include <stdlib.h>
struct x
{
int a;
What if I have huge amount of text? Do I need to aaa\nbbb\nccc\n ?? Is that the only way?
Can someone tell me how I would store multi line text?
eg
char *text = "AAA [Date]
BBB [Time]"
or
Why can I see all of my variables and other data? Is it the way I'm compiling my app?
Is this a 'best practice' method? I didn't find much info on it on google.
What does this do/achieve?
Thanks everybody, I've done as you've suggested but I'm still having issues. Now I'm getting 'redeclaration' errors, as a result of include the same header file more than once in my project. I think...
I'm relatively new to programming and have noticed whilst using certain API's that sometimes they tell you "this must be freed" and other times they don't mention it (but you should). My question is:...
Hi,
I'm declaring my structs in a seperate .h file like this
struct {
...
} eQ1;
I think I feel more comfortable with one function for each struct rather than attempting anything else.
Thanks for your help
Macgyver I believe you answered my question. Both structs are different in the actual code. But they do have some members that are the same and I wanted to alter these using one function rather than...
How do I pass any of my structures to one particular function of mine? e.g
struct {
int a[4];
int b[4];
} EQ1;
struct {
Hi,
I'm writing an application and it's getting quite large. How do you divide it up into numerous source files?
Thanks a lot, I'll have a look through it.
OK I must be missing something. Are you saying that the resulting array will be the equivalent of
char *smallArray[30];
As I need each element to be able to store a string rather than a single...
Thanks, but is that increasing the number of elements of the array? That's what I need to do.
Well that sucks. So how do I get a dynamic array that I can resize as needed?