#Some Linking questions

@(ICS)

  1. 预测执行情况
//l1.c
#include
long *a;
int main(int argc, char *argv[])
{
printf("%ld\n",*a);
return 0;
}

//l2.c
long a[3]={0,2016,1117};

预测执行情况

//l1.c
#include
extern long *a;
int main(int argc, char *argv[])
{
printf("%ld\n",*a);
return 0;
}

//l2.c
long a[3]={0,2016,1117};

修改l2.c中第一个元素的初始化值,使得l1.c输出2016

please organize your code
  1. 预测执行情况
//g1.c
#include
extern long a[];
int main(int argc, char *argv[])
{
printf("%ld\n",a[1]);
return 0;
}

//g2.c
static long array[3]={0,0xcafebabe,0};
long *a=array;
long b=0xdeadbeef;

3. 预测执行结果
\\a.c
char main[]={0xc3};
\\b.c
const char main=0xc3;
\\c.c
char main=0xc3;
\\d.c
char* main="\xc3";
\\e.c
const char* main="\xc3";
\\f.c
char const* main="\xc3";

0 thoughts on “Some Linking Questions

Leave a Reply

Your email address will not be published. Required fields are marked *