main()

{

static char
names[5][20]={"pascal","ada","cobol","fortran","perl"};

int i;

char *t;

t=names[3];

names[3]=names[4];

names[4]=t;

for (i=0;i<=4;i++)

printf("%s",names[i]);

}

Answers were Sorted based on User's Feedback



main() { static char names[5][20]={"pascal","ada","co..

Answer / susie

Answer :

Compiler error: Lvalue required in function main

Explanation:

Array names are pointer constants. So it cannot be
modified.

Is This Answer Correct ?    15 Yes 1 No

main() { static char names[5][20]={"pascal","ada","co..

Answer / manju

Its an error since names contains strings they cannot be
assigned like this.

Is This Answer Correct ?    6 Yes 3 No

Post New Answer

More C Code Interview Questions

main() { char *p="hai friends",*p1; p1=p; while(*p!='\0') ++*p++; printf("%s %s",p,p1); }

3 Answers  


Write out a function that prints out all the permutations of a string. For example, abc would give you abc, acb, bac, bca, cab, cba. You can assume that all the characters will be unique.

5 Answers   IITR, Microsoft, Nike,


Sorting entire link list using selection sort and insertion sort and calculating their time complexity

1 Answers   Infosys, Microsoft, NetApp,


main() { char *p = "hello world"; p[0] = 'H'; printf("%s", p); } a. Runtime error. b. “Hello world” c. Compile error d. “hello world”

5 Answers   HCL,


main() { static int a[3][3]={1,2,3,4,5,6,7,8,9}; int i,j; static *p[]={a,a+1,a+2}; for(i=0;i<3;i++) { for(j=0;j<3;j++) printf("%d\t%d\t%d\t%d\n",*(*(p+i)+j), *(*(j+p)+i),*(*(i+p)+j),*(*(p+j)+i)); } }

1 Answers  






what will be the output of this program? void main() { int a[]={5,10,15}; int i=0,num; num=a[++i] + ++i +(++i); printf("%d",num); }

3 Answers   Wipro,


Write a routine that prints out a 2-D array in spiral order

3 Answers   Microsoft,


program to find magic aquare using array

4 Answers   HCL,


Is it possible to print a name without using commas, double quotes,semi-colons?

7 Answers  


How do you sort a Linked List (singly connected) in O(n) please mail to pawan.10k@gmail.com if u can find an anser...i m desperate to knw...

6 Answers   Microsoft, MSD, Oracle,


Give a one-line C expression to test whether a number is a power of 2.

10 Answers   Microsoft,


writte a c-programm to display smill paces

2 Answers  


Categories