Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   extern struct (http://www.velocityreviews.com/forums/t497996-extern-struct.html)

vaibhaw 04-16-2007 11:37 AM

extern struct
 
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


All times are GMT. The time now is 02:02 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57