str_shuffle takes string as an argument then return a shuffled string.
Remember shuffle_str does not shuffle original string as
As it return a shuffled string so you can copy shuffled string into another string as
Syntax:
shuffle_str(string);
Examples:
#include<cquery.h>
void main(void)
{
char z[20] = "Cquery Rocks";
int i;
for(i = 0 ; i < 10 ; i++)
{
printf("%s\n",shuffle_str(z));
}
}
Remember shuffle_str does not shuffle original string as
#include<cquery.h>
void main(void)
{
char z[20] = "Cquery Rocks";
printf("%s\n",shuffle_str(z)); //possible output: kCoq rRuseyc
printf("%s",z); //output: Cquery Rocks (It didn't change)
}
As it return a shuffled string so you can copy shuffled string into another string as
#include<cquery.h>
void main(void)
{
char z[20] = "Cquery Rocks" , y[20];
strcpy(y,shuffle_str(z));
printf("%s\n",y); //possible output: kCoq rRuseyc
printf("%s",z); //output: Cquery Rocks (It didn't change)
}
#include<cquery.h>
void main(void)
{
char z[20] = "Cquery Rocks";
char *y;
y = shuffle_str(z);
printf("%s\n",y); //possible output: kCoq rRuseyc
printf("%s",z); //output: Cquery Rocks (It didn't change)
}
No comments:
Post a Comment