What is the difference between Char a[ ]=”string” and char
*a=”String”
Answer Posted / sushant mahajan
Ohk... dudes I think that 'C' in Char a[] is a typo. The only difference I can see is this:
char *a="string";
printf("%d", sizeof(a));
/*will print 2 or 4, whatever is the memory assigned to a pointer*/
char a[]="string";
printf("%d", sizeof(a));
/*will print 7 - 1 byte for each character+1 byte for the '\0' */
So basically its a memory thing :D
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
Write a program which is required to process the time of a clock in hours and minutes, entered from the keyboard. With this program, there are two requirements for any data entered by a user: 1. The data must be of the correct type (in this case, two ints). 2. The data must be in the correct range: this means that, for the minutes, negative numbers and any number above 59 must be rejected; for the hours, negative numbers and any number above 23 must be rejected. Output error message for invalid data input. Output the time one and a half hour after the time input. i.e. Hour: 22 Min: 32 One and a half hour after 22:32 is 00:02
Explain container class.
What is the cout in c++?
What is meant by entry controlled loop?
What data structure is fastest, on average, for retrieving data: a) Binary Tree b) Hash Table c) Stack
Explain the difference between new() and malloc() in c++?
Explain the register storage classes in c++.
What is a container class?
Is c++ a good beginners programming language?
Is swift a good first language?
What are the benefits of c++?
What is abstract class in c++?
What are namespaces in c++?
What are all predefined data types in c++?
Is c++ a dying language?