Sponsored Links


Results 1 to 2 of 2

Thread: i got the conecpt of string array as i asked before but i did not get this point

  1. #1
    sana.pari
    Guest

    Icon14 i got the conecpt of string array as i asked before but i did not get this point

    Sponsored Links1


    Dear Sir,

    i got the conecpt of string array as i asked before but i did not get this point then why just one character like 'a' is taking two byts. what is null character? and if 'a' is taking 2 bytes then we should declare like char s1[2] but we are doing just char s1. so please explain more please.



    Thank you very much


    Sponsored Links

  2. #2
    Dear student!
    Null character is special character that is added to array just to indicate end of string. If a string has n characters then it requires an n+1 element array (at least) to store it.
    A string variable s1 could be declared as follows:
    char s1[10];
    The string variable s1 could hold strings of length up to nine characters since space is needed for the final null character.
    The single-character string "a" is stored in two consecutive bytes holding the character `a' and the null character. It would declared as follow:
    char s1[2];

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-20-2014, 11:36 PM
  2. Replies: 0
    Last Post: 08-19-2014, 12:30 AM
  3. String to Char Array in Java 2011
    By Vuhelper in forum Java forum
    Replies: 0
    Last Post: 07-23-2011, 05:43 PM
  4. Pass string value into function as an array in c++
    By Vuhelper in forum C++ Programing
    Replies: 0
    Last Post: 06-11-2011, 06:42 PM
  5. How can we stop a programme at any point in C++?
    By sana.pari in forum C++ Programing
    Replies: 1
    Last Post: 04-24-2011, 06:50 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 | Jobs