Conversion of array of double value in to a character array :   I need to send an array of 4 double value in to a character buffer of size 8 byte  and also 
    would like to extract the value from the character array in to double value for its usage.
        -I am trying with the below code but not getting correct output as 
         char str is of size 8 byte is too little to store 4 double value !!
        -There might be some bit operation could solve the issue!! 
           
        Ex:
        #include<stdio.h>
        #include<string.h>
        #include<stdlib.h>
        int main()
        {
         char str[8]={'\0'};
         double x=-10.456678,p=12.678906,q=80.8956876,r=360.67,y,z,h,k;
         sprintf(&str[0],"%2.6f",x);
         sprintf(&str[1],"%2.6f",p);
         sprintf(&str[2],"%2.6f",q);
         sprintf(&str[3],%3.4f",r);
         //Extracting the same from str
         y=atof((char *)&str[0]);
         z=atof((char *)&str[1]);
         h=atof((char *)&str[2]);
         k=atof((char *)&str[3]);
    
         printf("\ny= %2.6f",y);
         printf("\nz= %2.6f",z);
         printf("\nh= %2.6f",h);
         printf("\nk= %2.6f",k);
         return 0;
         }
     Could anyone please answer
    Thanks in Advance!!


