write function to reverse char array ... without using second
array
Answers were Sorted based on User's Feedback
Answer / nagesh r. dalave
void main()
{
char strp20];
int len=0,i=0;
printf("\nEnter a string ");
gets(str);
while(str[i]!='\0')
{
i++;
len++;
}
printf("\nReverse of given string:");
while(i>=0)
{
printf("\n %c",str[i]);
i--;
}
getch();
}
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / kiran
{
char temp;
for(i,j=strlen(str)-1;i<j;i++,j--)
{
temp = str[i];
str[i] = str[j];
str[j] = temp;
}
return str;
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / sunitha
/* function to reverse a charactor array */
void rev_array(char str[])
{
char c;
char *p;
p=str;
while(*p)
{
if(*p!='\0')
{
c=p;
}
p++;
}
printf("reverse array is %s\n",c);
}
| Is This Answer Correct ? | 1 Yes | 7 No |
How do you initialize function pointers? Give an example?
Hai friends im a i year student. i want to develop my knowledge in the field of TSR in c. How I'm Improve ?
What are all different types of pointers in c?
what does the following function print? func(int i) { if(i%2)return 0; eale return 1; } main() { int =3; i=func(i); i=func(i); printf("%d",i);}
a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.
What does %2f mean in c?
A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles
What does a pointer variable always consist of?
write a program to print the one dimensional array.
What is indirection?
program to convert a integer to string in c language'
Explain union. What are its advantages?