extern struct

Joined
Apr 16, 2007
Messages
1
Reaction score
0
file 1.c
#include<stdio.h>
void fun();
typedef struct
{
int aa;
char* b;
}a;


void fun()
{
a *a1;
a1->aa = 12;
a1->b = (char*)malloc(sizeof(5));
a1->b = "hello";
printf("hello====%d\n",a1->b);
}



file2.c

#include<stdio.h>

extern a1

int main()
{


printf("%d\n",a1->b);

return 0;
}


i am not able to excute file2.c .. how can i use struct member b , without including this file(file1.c) into file2.c ,since both are in the same directory
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top