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 *str1="abcd"; char str2[]="abcd"; printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd")); }

1 Answers  


String reverse with time complexity of n/2 with out using temporary variable.

10 Answers   NetApp, Symantec,


how to create a 3x3 two dimensional array that will give you the sums on the left and bottom columns

0 Answers  


main() { while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }

1 Answers  


1) int i=5; j=i++ + i++ + i++; printf("%d",j);This code gives the answer 15.But if we replace the value of the j then anser is different?why? 2)int i=5; printf("%d",i++ + i++ + i++); this givs 18.

8 Answers   IBPS, Infosys, TCS,






What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?

1 Answers  


abcdedcba abc cba ab ba a a

2 Answers  


How to reverse a String without using C functions ?

33 Answers   Matrix, TCS, Wipro,


#include<stdio.h> main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s=malloc(sizeof(struct xx)); printf("%d",s->x); printf("%s",s->name); }

1 Answers   TCS,


#define int char main() { int i=65; printf("sizeof(i)=%d",sizeof(i)); }

1 Answers  


&#8206;#define good bad main() { int good=1; int bad=0; printf ("good is:%d",good); }

2 Answers  


program to find the roots of a quadratic equation

14 Answers   College School Exams Tests, Engineering, HP, IIIT, Infosys, Rajiv Gandhi University of Knowledge Technologies RGUKT, SSC,


Categories