0 votes 0 votes akash.dinkar12 asked Dec 9, 2017 akash.dinkar12 492 views answer comment Share Follow See all 3 Comments See all 3 3 Comments reply saxena0612 commented Dec 9, 2017 reply Follow Share Less than M+n given you are not trying to concatenate the one which is in READ ONLY SEGMENT! 0 votes 0 votes Anu007 commented Dec 9, 2017 reply Follow Share as i think a will be ans given, string ending with \o so when concatnate \o will be come one time is array is assume 1 votes 1 votes Ashwin Kulkarni commented Dec 9, 2017 reply Follow Share m+n will count twice '\0' hence for concatinating we have to remove that middle \0. hence lenfth will be less than m+n 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes i think answer should be B. what is answer ? Dharmendra Lodhi answered Aug 29, 2018 Dharmendra Lodhi comment Share Follow See all 4 Comments See all 4 4 Comments reply akash.dinkar12 commented Aug 29, 2018 reply Follow Share how??? 0 votes 0 votes Dharmendra Lodhi commented Aug 29, 2018 reply Follow Share #include <stdio.h> int main(void) { char str1[100]="hello",str2[100]="world"; printf("Before :%s, %s\n",str1,str2); concatenate(str1,str2); printf("After :%s,%d",str1,strlen(str1)); return 0; } void concatenate(char s1[],char s2[]){ int i=0,j=0; while(s1[i]!='\0'){ i++; } while(s2[j]!='\0'){ s1[i]=s2[j]; i++; j++; } s1[i]='\0'; } 0 votes 0 votes akash.dinkar12 commented Aug 29, 2018 reply Follow Share As if u are storing one string in space m and another string in space n, these individual strings will contain one terminating null character and then if we try to concatenate then one null character will be gone and our space required after concatenation will be less than m + n 0 votes 0 votes Dharmendra Lodhi commented Aug 29, 2018 reply Follow Share length=5 H E L L O \0 length=5 W O R L D \0 length=10 H E L L O W O R L D \0 we does not count '\0' 0 votes 0 votes Please log in or register to add a comment.