Find the length of the string using recursion

Given a string, calculate the length of the string (number of characters in the string excluding '\0' the null character.



#include <stdio.h>
#include<string.h>
#include<stdlib.h>
int length(char *s,int a)
{
  if(*s=='\0')
  return 0;
  return a+length(++s,a);
}
int main(void) {
  char *s;
  int a=1;
  s=(char*)malloc(sizeof(char));
  scanf("%s",s);
  printf("%d",length(s,a));
  return 0;
}