#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
struct mystruct {
int a;
};
typedef struct mystruct * pmystruct;
pmystruct getpstruct()
{
pmystruct temp=(pmystruct)malloc(sizeof(pmystruct*));
return temp;
}
int main(int argc, char* argv[])
{
int * fred;
pmystruct b= getpstruct();
b->a = 8;
++b->a;
printf ("The value of b->a is %i \n",b->a);
free(b);
fred = (int *) malloc(sizeof(int));
memset(fred,0x100,sizeof(int));
printf("Value of *fred = %i\n",*fred);
free(fred);
return 0;
}
Thursday, February 10, 2011
POINTER STRUCTURES EXAMPLE PROGRAM IN C
Labels:
POINTERS,
STRUCTURES
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment