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 can type-insensitive macros be created?
1.Why do you call C is middle level language? 2.Why do you call C is userfriendly language.
Explain what is the benefit of using enum to declare a constant?
write a c program to find largest of three numbers using simple if only for one time.
Explain modulus operator.
Can you think of a way when a program crashed before reaching main? If yes how?
Why is structure padding done in c?
How do c compilers work?
What is auto keyword in c?
a 'c' program to tell that the set of three coordinates lie on a same line
what do you mean by defining a variable in our c code?
How can I write functions that take a variable number of arguments?