employer cover photo
employer logo
employer logo

Servion Global Solutions

Is this your company?

Servion Global Solutions interview question

string length for commend line argument.

Interview Answers

Anonymous

12 Oct 2017

#include #include void main(int argc,char *argv[]) { int len; char *ptr; clrscr(); if ( argc != 2) { printf("\n Invalid arguments "); exit(0); } else { ptr=argv[1]; len=0; while ( *(ptr+len) != '\0') { len++; } printf("\n Length is %d",len); } }

4

Anonymous

27 Sept 2020

public class strLength { public static void main(String args[]) { String s1="Test"; System.out.println("string length is: "+s1.length()); }}