Sponsored Links


Results 1 to 2 of 2

Thread: Regarding variable declaration, i know about interger types

  1. #1
    sana.pari
    Guest

    Icon14 Regarding variable declaration, i know about interger types

    Sponsored Links


    Dear Sir,

    Sponsored Links

    Regarding variable declaration, i know about interger types and charecter types but what is data type of string? let say, in the assignment, we have one input that "take the customer name" so that is not character. what should we do in that case? Please explain in detail with examples.



    Thank you very much.

  2. Sponsored Links
  3. #2
    Administrator Xpert's Avatar
    Join Date
    May 2010
    Location
    Jhelum
    Posts
    6,217
    Dear student!
    In such case where we need to store string, we use char array data type. Which is used to represent a sequence of characters regarded as a single data item. In C++, strings of characters are held as an array of characters, one character held in each array element. In addition a special null character, represented by `\0', is appended to the end of the string to indicate the end of the string. Hence if a string has n characters then it requires an n+1 element array (at least) to store it. Thus the character `a' is stored in a single byte, whereas the single-character string "a" is stored in two consecutive bytes holding the character `a' and the null character.

    For example: A string variable s1 could be declared as follows:
    char s1[10];

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 08-23-2012, 09:31 PM
  2. Replies: 0
    Last Post: 07-17-2011, 03:56 PM
  3. forward declaration instead of header files in c++ 2011
    By Vuhelper in forum C++ Programing
    Replies: 0
    Last Post: 06-15-2011, 06:22 PM
  4. Replies: 0
    Last Post: 05-30-2011, 03:20 PM
  5. Replies: 1
    Last Post: 04-24-2011, 07:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
-: Vuhelp Disclaimer :-
None of the files shown here are hosted or transmitted by this server. The links are provided solely by this site's users. The administrator's or staff of Vuhelp.net cannot be held responsible for what its users post, or any other actions of its users. You may not use this site to distribute or download any material when you do not have the legal rights to do so. It is your own responsibility to adhere to these terms. If you have any doubts about legality of content or you have any suspicions, feel free to contact us.
Online Education | JhelumSoft