Tuesday, August 16, 2005

Something basic abt declaring structures

struct a_1{
int a;
char b[10];
};

The above does not declare any variable. It only associates the structure's type with a_1.
struct a_1 A;

This is the one that actually does the job of creating a structure named A with the type struct a_1 .

It can also be done using the foll statement:
struct {
int a;
char b[10];
} A;

This obviates the use of the second statement (struct a_1 A;) .
If I need to declare a structure pointer the foll shud be done.

struct {
int a;
char b[10];
} *A;

OR

typedef struct {
int a;
char b[10];
} A_t;
A_t *A;

Dont forget to malloc A .

(Taken from a mail that i sent to myself on 20/05/2005)

Saturday, August 13, 2005

Wrting to ROM ???

char* s = "I AM GOOD"; and s[5] = ‘a’will give a core dump. Compiler : gcc 2.92 . May be writing to ROM memory, gave the core.

Friday, August 12, 2005

Whats this for ?

This is a purely technical blog. Things that i've learnt and found interesting have been put up in this blog. I hope i cud get in more and more here.