Q.-Write a function that receives a string as an argument and returns after togging the case of every alphabet and create a pointer to your function named as “Toggler”?
i made this code please help...
//Progrma to toggle case of every alphabet
#include<iostream.h>
#include<conio.h>
#include<ctype.h>
char string(char []); //function prototype to toggle the case of string
main()
{
char a[50];
gets(a);
fflush(stdin);
char (*Toggler)(char []); //function to pointer
Toggler=string; //assigning the address of function to pointer
string(a); //calling function
cout<<"String after toogling :"<<Toggler;
getch();
}
char string(char a[]) //function defination to toggle the case of string
{
for(int i=0;a[i]!='\0';i++)
{
if(isupper(a[i])) //changing the case
{
a[i]=tolower(a[i]);
}
elseif(islower(a[i]))
{
a[i]=toupper(a[i]);
}
}
return (&a);
}