Question #210239

Write a C program to print the string and its length using functions


Expert's answer

#include<stdio.h>
#include<string.h>

void printstr(char *ptr){
  printf("The String is : %s",ptr);
  int len=strlen(ptr);
  printf("\nLength of String is : %d",len);
}
int main(){
  char str[20]="Hello world!";
  printstr(str);
  return 0;
}
LATEST TUTORIALS
APPROVED BY CLIENTS