Home > Back-end >  Save the children!
Save the children!

Time:04-30

CodePudding user response:

The
refer to the original poster Zhi nine lyp reply:

#include
Void separate (float x, int * y, float * z);
Void main ()
{
Float data, * z;
Int * y;
Printf (" input from the keyboard a real data: ");
The scanf (" % f ", & amp; The data);
To separate (data, y, z);
Printf (" % d, % f ", * y * z);
}
Void separate (float x, int * y, float * z)
{

X * y=(int);
* z=x * y;



}
Why do I always run out

CodePudding user response:

 void separate (float x, int * y, float * z); 
Int main () {
Float data, z;
int y;
Printf (" input from the keyboard a real data: ");
The scanf (" % f ", & amp; The data);
Separate (data, & amp; Y, & amp; Z);
Printf (" % d, % f ", y, z);
}
Void separate (float x, int * y, float * z)
{

X * y=(int);
* z=x * y;

}

CodePudding user response:

Z and y is pointer is no point to data space

CodePudding user response:

 
Float data, * z=(float *) malloc (1);
Int * y=(int *) malloc (1);

CodePudding user response:

 # include & lt; stdio.h> 

Void separate (float x, int * y, float * z);

//void main ()
Int main (void)
{
//float data, * z;
Float data, z;
//int * y;
int y;

Printf (" input from the keyboard a real data: ");
The scanf (" % f ", & amp; The data);
Printf (" % f \ n ", data);
Separate (data, & amp; Y, & amp; Z);
//printf (" % d, % f ", * y * z);
Printf (" % d, % f ", y, z);
}

Void separate (float x, int * y, float * z)
{
X * y=(int);
* z=x * y;
}

For your reference ~

Two Pointers are wild pointer, you need to allocate space, or directly with normal variables

CodePudding user response:


 
Void separate (float x, int * y, float * z)
{
X * y=(int);
* z=x * y;
}

 
Float data, * z=(float *) malloc (1);
Int * y=(int *) malloc (1);
Printf (" input from the keyboard a real data: ");
Scanf_s (" % f ", & amp; The data);
To separate (data, y, z);
Printf (" % d, % f ", * y * z);

CodePudding user response:

reference 4 floor wise men know already should good karma response:
 
Float data, * z=(float *) malloc (1);
Int * y=(int *) malloc (1);
wrong new friends don't learn

CodePudding user response:

refer to 6th floor wise men know already should good karma response:

 
Void separate (float x, int * y, float * z)
{
X * y=(int);
* z=x * y;
}

 
Float data, * z=(float *) malloc (1);
Int * y=(int *) malloc (1);
Printf (" input from the keyboard a real data: ");
Scanf_s (" % f ", & amp; The data);
To separate (data, y, z);
Printf (" % d, % f ", * y * z);
perpetuated this misunderstanding first
You can't have a good look at the parameters of the malloc what meaning be?
All pass 1 oh

CodePudding user response:

 # include & lt; stdio.h> 
# pragma warning (4996) disable:
Void separate (float x, int * y, float * z);
Int main ()
{
Float data, z;
int y;
Printf (" input from the keyboard a real data: ");
The scanf (" % f ", & amp; The data);
Separate (data, & amp; Y, & amp; Z);
Printf (" % d, % f ", y, z);
}
Void separate (float x, int * y, float * z)
{
* y=x;
* z=x * y;


}
  • Related