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 I find leaf node with smallest level in a binary tree?
C program code int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+zap(n-1); } then the call zap(6) gives the values of zap [a] 8 [b] 9 [c] 6 [d] 12 [e] 15
How we can set and clear bit in a byte using macro function?
What is a pointer on a pointer in c programming language?
what are the languages used in c#?
What does calloc stand for?
Find the highest of three numbers and print them using ascending orders?
You have an array of n integers, randomly ordered with value 1 to n-1.The array is such that there is only one and one value occurred twice. How will you find this number?
Define function ?Explain about arguments?
2 Answers Geometric Software, Infosys,
What is pragma in c?
What does emoji p mean?
what do you mean by defining a variable in our c code?