|
INTERVIEW QUESTIONS
PROGRAMMING LANGUAGES
C
DETAILS
Question: What is the difference between the following statements? int a[4]={1,2,3,4}; int a[]={1,2,3,4);
Answer: In the second array The braces which closes the elements are wrong, it should be flower braces.
|
|
|
Category |
C Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.3) By 6609 users |
Added on |
5/18/2013 |
Views |
70690 |
Rate it! |
|
|
Question:
What is the difference between the following statements? int a[4]={1,2,3,4}; int a[]={1,2,3,4);
Answer:
In the second array The braces which closes the elements are wrong, it should be flower braces. Source: CoolInterview.com
Answered by: Rajesh Mohan | Date: 6/18/2008
| Contact Rajesh Mohan
But here the concept is the first array is of fixed size . while the second is a fixed size. the main thing is at memory.the first will allocate only 8 bytes and it does not accept more values . Source: CoolInterview.com
Answered by: anil | Date: 8/25/2008
| Contact anil
int a[4] means only 16 bytes r allocated so we can store only a elements but int a[] ={1,2,34} means we can create as many elements as possible mem 'll be allocated only after initialization Source: CoolInterview.com
Answered by: manik | Date: 3/21/2009
| Contact manik
in the first array it define the size of an array but it can accept more than 4elements because there is no bounds checing in 'c' language .it overwrite about any important information Source: CoolInterview.com
Answered by: mukul garg | Date: 9/29/2009
| Contact mukul garg
The first array has a fixed size of 8 bytes, and it cannot accept any more elements. In the second array, memory is allocated only after initialization, i.e. there is no pre allocation of memory as in the previous array format. Source: CoolInterview.com
Answered by: Radhika B. | Date: 2/1/2010
| Contact Radhika B.
All the concepts are right but if we see the statements there is a syntax error while declaring the varibles. Source: CoolInterview.com
Answered by: murali | Date: 5/22/2010
| Contact murali
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
How can we get direct printout of a c file without giving print command from bin or tc?eg i want to get the printout of a program directly after execution from the c window itself.
|
View Answer
|
|
Write a C program that will convert Simple Sentence to Complex/Compound Sentence.
|
View Answer
|
|
Can anyone share his code which would accept a sentence, then count the number occurrence of the words excluding spaces.All is done using linked list.
|
View Answer
|
|
using c-strings write a program that will analyse the text"1.1my brother is taller than me.1.2 I am a boy of sixteen years old". The program should remove multiple spaces betweem words,find the longest word in the text,search and identify the number of letters"e", extact the number of integers , extract the number of doubles, extract the number of words in each sentence and identify the number of sentences in the text.
|
View Answer
|
|
Q.8 When a 'C' function call is made, the order in which parameters passed to the function are pushed into the stack is (a) left to right (b) right to left (c) bigger variables are moved first than the smaller variables. (d) smaller variables are moved first than the bigger ones (c) none of the above.
|
View Answer
|
|
void main() { float a= 0.7; if (a < 0.7) printf("c"); else printf("c++"); } Output of the above program is c. Why? Whereas the same program with 0.8 instead of 0.7 gives c++ as the output? Why explain?
|
else printf("c++") - C Interview Questions & Answers">
View Answer
|
|
What is difference between the test effort and the test procedure?
|
View Answer
|
|
How to write a program for pascal triangle?
|
View Answer
|
|
Write a program to remove comment lines and blank lines from an error free c program.
|
View Answer
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All C Interview Questions & Answers - Exam Mode /
Learning Mode
|