struct S { int i; int * p;}; main () {S s ; int *p =&s.i ; p[0]=4; p[1]=3; s.p=p; s.p[1]=1;s.p[0]=2struct S { int i; int * p;}; main (){S s ;int *p =&s.i ;p[0]=4;p[1]=3;s.p=p;s.p[1]=1;s.p[0]=2:} 请问程序会在哪一行崩溃?要不然看不懂~@@

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/11 23:18:35
struct S { int i; int * p;}; main () {S s ; int *p =&s.i ; p[0]=4; p[1]=3; s.p=p; s.p[1]=1;s.p[0]=2struct S { int i; int * p;}; main (){S s ;int *p =&s.i ;p[0]=4;p[1]=3;s.p=p;s.p[1]=1;s.p[0]=2:} 请问程序会在哪一行崩溃?要不然看不懂~@@

struct S { int i; int * p;}; main () {S s ; int *p =&s.i ; p[0]=4; p[1]=3; s.p=p; s.p[1]=1;s.p[0]=2struct S { int i; int * p;}; main (){S s ;int *p =&s.i ;p[0]=4;p[1]=3;s.p=p;s.p[1]=1;s.p[0]=2:} 请问程序会在哪一行崩溃?要不然看不懂~@@
struct S { int i; int * p;}; main () {S s ; int *p =&s.i ; p[0]=4; p[1]=3; s.p=p; s.p[1]=1;s.p[0]=2
struct S { int i; int * p;};
main ()
{S s ;
int *p =&s.i ;
p[0]=4;
p[1]=3;
s.p=p;
s.p[1]=1;
s.p[0]=2:
} 请问程序会在哪一行崩溃?要不然看不懂~@@

struct S { int i; int * p;}; main () {S s ; int *p =&s.i ; p[0]=4; p[1]=3; s.p=p; s.p[1]=1;s.p[0]=2struct S { int i; int * p;}; main (){S s ;int *p =&s.i ;p[0]=4;p[1]=3;s.p=p;s.p[1]=1;s.p[0]=2:} 请问程序会在哪一行崩溃?要不然看不懂~@@
程序应该在最后一句崩溃,
struct S { int i; int * p;};
main ()
{S s ;
int *p =&s.i ; //p指针指向s结构体中变量i
p[0]=4; //p[0] = 4;给i赋值4;
p[1]=3; //p[1]指向s.p指针,p指针占用8字节,p[1] =3修改了s.p指 针的低位,所以不会出错.
s.p=p; //s.p = p使s.p指向自身地址
s.p[1]=1; //修改了s.p指针高位的值,s.p指向未知内存
s.p[0]=2://操作s.p指向的内存,程序崩溃
}

struct S { int i; int * p;}; main () {S s ; int *p =&s.i ; p[0]=4; p[1]=3; s.p=p; s.p[1]=1;s.p[0]=2struct S { int i; int * p;}; main (){S s ;int *p =&s.i ;p[0]=4;p[1]=3;s.p=p;s.p[1]=1;s.p[0]=2:} 请问程序会在哪一行崩溃?要不然看不懂~@@ 一道数据结构题:#include #include #define STACK_INIT_SIZE 100#define STACKINCREMENT 10#define OK 1#define ERROR 0typedef struct{int *base;int *top;int stacksize;}SqStack;int InitStack(SqStack *S){S->base=(int *)malloc(STACK_INIT_SIZE*sizeof(i 请问 scanf(%s%d,s[i].name,&s[i].score); 语句中为什么s[i].name 前可以不加 & s[N] 是结构体数组,定义如下;struct {int num;char name[10];int score;}s[N]; #include #include int page(int A,int L );int Segment(int sn,int sl);int SegPagt(int sn,int pn,int pd);typedef struct segtable {int segf[256];int segl[256];}segtable;struct segtable st;typedef struct segpagt{int segf[256];int segl[256];int ptl[256];in 求大手帮忙一一解释下意思 急.#include stdio.h#include stdlib.h#include windows.h#define N 10 /*输入10个数*/struct d{int data;struct d * next;};typedef struct d D;D * creat(){int i;D *h,*s,*r;h=(D *)malloc(sizeof(D));r=h;srand(ti 一直提示syntax error : ';',我实在是找不到错误,求大神看看程序.#include stdio.h#include stdlib.htypedef struct node{ int data; struct node*next;}numberlist; struct node*creatlink() {numberlist*h=NULL; int n,i; numberlist*p,*s 北大ACM试题1005我用C语言写的代码如下:请问为甚么总是presentation error?#include #include #define SIZE 1000struct coordinate{double x;double y;}point[SIZE];int main(){int i;int n;struct coordinate point[SIZE];double s ;int year;d 文件 DoubleList.htypedef struct DulNode{ int data; struct DulNode *prior; struct DulNode *next;}DulNode;文件 DoubleList.cHead *InitLink(){ printf(请输入节点的值,0为结束标志:); Head *p; DulNode *q,*s; int elem; p = (struct Head *)mal #include#include#define MAXNUM 20struct stacktype{int stack[MAXNUM];int top;};void InitStack(struct stacktype *s){s->top=-1;}int StackEmpty(struct stacktype *s){return(s->top==0);}int push(struct stacktype *s,int x){ if(s->top >= MAXNUM-1)return fals 第一行 type TYPE *creat(int n) { struct stu *head,*pf,*pb; int i; for(i=0;i struct student{int num,int score}stu; struct student *p;stu *sp和s这两个指针有什么区别,分别有什么不同的用法!请举例说明, Presentation Error#includeusing namespace std;struct ArcNode{int adjvex;ArcNode *next;};struct VertexNode{char vertex;ArcNode *firstedge;};const int MaxSize = 10;class ALGraph{public:ALGraph(char a[],int n,int e);ALGraph(){}char GetVex(int i);void Pu struct{int i;char c;float a}test;则sizeof(test)的值是 left operand must be l-value什么意思# include # define M 10typedef struct{ char num[10];int s;} SCORE;int fun(SCORE *a,SCORE *b){int i,j=0;b[0].s=a[0].s;for(i=1;i Searching other element in struct in Binary Search Tree in i have already implemented whole code...the BST is sorted by ID.But what can i do to find the highest number of other element?struct TNode {int id;char name[100];float balance;TNode * left;TN struct S {int a,b;} data [2]={10,100,20,200}; mian() {struct S p=data[1;] printf(%d ,++(p.a)); } 帮填下空```C语言菜鸟题#define FMAT %d %s %f struct { int i;char str[10];float w;}a1;main(){scanf(%d %s %f,_________);printf(FMAT ,__________);} C语言统计数字程序 部分语句求解释程序如下/*统计数字*/#include #include struct count{long d;long c;};void main(){struct count a[10000];long n,x,i,j,k;int c=0;FILE *fp;fp=fopen(F:\count.in,r);fscanf(fp,%ld,&n);for(i=0;i