malloc

[C] Data structure problem

Hello. I made a structure like so: struct ponto { int x; int y; int z; }; 1) Can I initialize the int's with a default value? int var = value; doesn't seem to work, compiler says "syntax error before '=' token" or something of sorts. 2) I need to work with several of these like in a array of structures, but I only know ho...

How do I allocate more space for my array of C structs?

I'm trying to add 10 more elements to my struct that has been already malloc with a fixed sized of 20. This is the way I have my struct defined: #include <stdio.h> #include <stdlib.h> #include <string.h> struct st_temp { char *prod; }; int main () { struct st_temp **temp_struct; size_t j; temp_struct = malloc (sizeof *tem...