Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
In C++ is SPACE is also a charactor??
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 tried to display my name through arrays in previous lectures and i successfully did that. but no i tried to display my complete name through arrays like TARIQ MEHMOOD. in this case only tariq is printed on the screen where as mehmood is skipped away. what is the solution to display my complete name including space?????
Reply
#2
Dear student!
You should check initialization of array. String array can be initialised at the time of declaration just as other variables are initialised. For example:
char s1[] = "example";
char s2[20] = "another example" would store the two strings as follows:

s1 |e|x|a|m|p|l|e|\0|
s2 |a|n|o|t|h|e|r| |e|x|a|m|p|l|e|\0|?|?|?|?|
Reply


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