//========================
Program in C to reverse a string using pointer, revstrusingptr.c
#include<stdio.h>
#include<string.h>
int main()
{
char orgstr[50];
char revstr[50];
char *p1,*p2;
printf("Enter the string to reverse:\n");
scanf("%s",orgstr);
printf("You entered: %s \n", orgstr);
p1=orgstr+ strlen(orgstr)-1;
p2=revstr;
while(p1>=orgstr)
*p2++ = *p1--;
*p2='\0';
printf("Reversed String is: %s \n",revstr);
return 0;
}
Program in C to reverse a string using pointer, revstrusingptr.c
#include<stdio.h>
#include<string.h>
int main()
{
char orgstr[50];
char revstr[50];
char *p1,*p2;
printf("Enter the string to reverse:\n");
scanf("%s",orgstr);
printf("You entered: %s \n", orgstr);
p1=orgstr+ strlen(orgstr)-1;
p2=revstr;
while(p1>=orgstr)
*p2++ = *p1--;
*p2='\0';
printf("Reversed String is: %s \n",revstr);
return 0;
}
Program in C++/CPP/C to reverse a string using pointer
ReplyDeleteProgram in C++/CPP/C to reverse a string using pointer
Program in C++/CPP/C to reverse a string using pointer
Program in C++/CPP/C to reverse a string using pointer
Program in C++/CPP/C to reverse a string using pointer
ReplyDeleteProgram in C++/CPP/C to reverse a string using pointer
Program in C++/CPP/C to reverse a string using pointer
Program in C++/CPP/C to reverse a string using pointer
Program in C++/CPP/C to reverse a string using pointer
ReplyDeleteProgram in C++/CPP/C to reverse a string using pointer
Program in C++/CPP/C to reverse a string using pointer
Program in C++/CPP/C to reverse a string using pointer
Program in C++/CPP/C to reverse a string using pointer
Program in C++/CPP/C to reverse a string using pointer
Program in C++/CPP/C to reverse a string using pointer
Program in C++/CPP/C to reverse a string using pointer
Program in C++/CPP/C to reverse a string using pointer
Program in C++/CPP/C to reverse a string using pointer
C++ Program to reverse a string
ReplyDeleteC++ Program to reverse a string
C++ Program to reverse a string
C++ Program to reverse a string
C++ Program to reverse a string
C++ Program to reverse a string
C++ Program to reverse a string