Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Go through the following code sinippet
char a[20];
a="Hello Orcale Test";
will this compile?

Answers were Sorted based on User's Feedback



Go through the following code sinippet char a[20]; a="Hello Orcale Test"; will..

Answer / jaisai

No...
Compile time error will occur says

"left operand must be l-value"

alternatively

char *a;
a="Hello Orcale Test";

will compile....

Is This Answer Correct ?    6 Yes 0 No

Go through the following code sinippet char a[20]; a="Hello Orcale Test"; will..

Answer / vikraman.j

Compile time err wil occur;
We can use *a="Hello Orcale Test" or a[20]="Hello Orcale
Test";
It will lead the prg nice.

Is This Answer Correct ?    2 Yes 0 No

Go through the following code sinippet char a[20]; a="Hello Orcale Test"; will..

Answer / pradeep

Dear frd,

char a[20];
a="Hello Orcale Test";

Here you are trying to "assign" constant char string to
address variable , as you are aware that name of an array
points to the first address of the array element. So here
you wil get an error message saying L value is required.

and also
char *a;
*a="hello" ; also will give an error as you are trying to
assign constant characters to char type variable.
Type mismatch will occur.

so I suggest you to use the strcpy method to copy a
constant character string to char*

so soln is
char a[20];
strcpy(a,"hello world");

or char *a;
a="hello";

Is This Answer Correct ?    2 Yes 0 No

Go through the following code sinippet char a[20]; a="Hello Orcale Test"; will..

Answer / vignesh1988i

the above variable 'a' is a character array , so i would not been wrong if it has been initilized on the same line.....
but they have done that in the next line , there lies the mistake... THIS PROGRAM WILL GIVE AN ERROR why because we cant copy the entire string in a single travel by using '='(assignment) operator unless it's an initilization directly/.....


thank u

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

WHAT IS C?

6 Answers  


what is an ERP?

2 Answers   Infotech,


Explain demand paging.

1 Answers   Agilent,


Explain how can I remove the trailing spaces from a string?

0 Answers  


Explain what does the function toupper() do?

0 Answers  


What is hungarian notation? Is it worthwhile?

0 Answers  


Is flag a keyword in c?

0 Answers  


What is a program flowchart and how does it help in writing a program?

0 Answers  


why TCS selected more student in the software field from all institution.

5 Answers   TCS,


in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.

0 Answers   TCS,


Create a structure to specify data on students as given below: Roll number, Name, Department, Course, and Year of joining. Assume that there are not more than 450 students in the collage. (a) Write a function to print the names of all students who joined in the last 3 years. (b) Write a function to print the data of a student whose roll numbers are divisible by 4.

0 Answers  


Can a variable be both const and volatile?

0 Answers  


Categories