what is difference between array of characters and string

Answer Posted / zubair

String is much same as character array, it can also be
checked by each characters:
string str;for(int i=0;str[i]!='\0';i++) cout <<str[i]<<endl;

1. The NULL terminator is loaded automatically in string.('\0')
2.Both of them drop the data after space when we take input.

Is This Answer Correct ?    35 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.

4545


Is that possible to store 32768 in an int data type variable?

692


What do the functions atoi(), itoa() and gcvt() do?

724


How to establish connection with oracle database software from c language?

1675


What is a nested formula?

605






How can I change the size of the dynamically allocated array?

632


What is the purpose of 'register' keyword in c language?

629


Why pointers are used?

633


How do you sort filenames in a directory?

714


What is static volatile in c?

576


struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer

766


What is string in c language?

625


What are the rules for the identifier?

671


What are structures and unions? State differencves between them.

617


What is the meaning of typedef struct in c?

594