Write a C program to print the string and its length using functions
#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;
}
Comments
Leave a comment