P174. Program to find length of multiple strings using command line input.
#include<stdio.h>
#include<string.h>
void
main(int argc,char **argv)
{
if(argc<2)
{
printf("Usage ./a.out
String1 String 2 ... \n");
return;
}
for(int i=1;i<argc;i++)
{
printf("The length of %s
is %ld\n",argv[i],strlen(argv[i]));
}
}
Comments
Post a Comment