What will be the output of the following program?
#include<stdio.h>
void swap(char **s1, char **s2){
char *tmp;
tmp=*s1;
*s1=*s2;
*s2=tmp;
}
int main()
{
char *str[3]= {"orange", "apple", "pear"};
for (int i = 0; i<2; i++)
swap(&strs[i], &strs[i+1]);
printf("%s %s %s", strs[0], strs[1], strs[2]);
}
- pear apple orange
- apple pear orange
- orange apple pear
- apple orange pea