php hit counter

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
i got the conecpt of string array as i asked before but i did not get this point
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#1
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
Reply
#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];
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  array project code c++ 2011 Vuhelper 0 1,329 12-10-2011, 06:32 PM
Last Post: Vuhelper
  get length of a dynamic array in c++ 2011 Vuhelper 0 922 07-20-2011, 10:50 PM
Last Post: Vuhelper
  Multidimensional Array vs If-Statements and Functions? in c++ Vuhelper 0 891 07-20-2011, 10:45 PM
Last Post: Vuhelper
  C++ stringstream array to int in c++ 2011 Vuhelper 0 2,525 07-19-2011, 06:35 PM
Last Post: Vuhelper
  adding rows and columns of a multi array in c++ 2011 Vuhelper 0 1,115 07-12-2011, 11:03 PM
Last Post: Vuhelper
  Passing 2d array by reference June 2011 Vuhelper 0 970 06-19-2011, 06:11 PM
Last Post: Vuhelper
  Passing into function array of matrix in c++ 2011 Vuhelper 0 2,569 06-15-2011, 06:24 PM
Last Post: Vuhelper
  Creating a Random String in c++ 2011 Vuhelper 0 1,353 06-14-2011, 09:14 PM
Last Post: Vuhelper
  Pass string value into function as an array in c++ Vuhelper 0 1,004 06-11-2011, 06:42 PM
Last Post: Vuhelper
  initialization of array in c++ Vuhelper 0 3,124 06-04-2011, 08:05 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support