Replace lowercase letters by uppercase and vice versa using library function

Given a string which is of uppercase letters and lowercase alphabets , replace all the upper case letters to lower case letters and vice versa using library function



#include <stdio.h>
#include<string.h>
#include<stdlib.h>
int main(void) {
   char *s;
   int len;
   s=(char*)malloc(sizeof(char));
   scanf("%s",s);
   len=strlen(s);
   while(*s)
   {
     if(islower(*s))
      *s=toupper(*s);
     else if(isupper(*s))
      *s=tolower(*s);
     s++;
   }
   s=s-len;
   printf("%s",s);
   return 0;
}