I was recently reading a C tutorial and came across an unfamiliar way of making a function.
I was hoping someone could clear this up for me ... the code is below - im talking about the line after
"void swap(pnta, pntb)" where the line "float *pnta, *pntb;" appears ... I was always under the impression that directly after the function header came the blockquote "{"
Thanks in advance - /\/\artin
Code:
#include <stdio.h>
void swap();
int main(){
float a,b;
printf("Enter two numbers: ");
scanf("%f %f", &a, &b);
if (a<b)
swap(&a,&b);
printf("The required order is: %5.2f %5.2f\n",a,b);
return 0;
}
void swap(pnta, pntb)
float *pnta, *pntb;
{
float temp;
temp = *pnta;
*pnta = *pntb;
*pntb = temp;
}