There are a load of problems here.
You're passing a constant string to a function and then trying to write into it. That isn't allowed, any more than I can change your own name by writing mine over the top on your birth certificate!
It's because you declare a pointer to a character variable called
newi
but you don't give it a value at all. So when you try to copy the string that the function returns into it, it hasn't got anywhere to put it.
Try this:
#include<stdio.h>
#include<string.h>
char* newme(char* input1);
int main()
{
char data[100];
char newi[100];
strcpy(newi,newme(data));
return 0;
}
char* newme(char* input1)
{
float p=22.9999,w=99.83234,r=333.523422;
sprintf(input1," %.2f,%.2f,%.2f",p,w,r);
printf("%s",input1);
return input1;
}
It should work better.