I have this program that is suppose to give me the reversal of a message that i write, using pointers.
This is what i have, however, it seems there is a little problem with it because it gives me unknown symbols instead of the inverse words.
Can anyone tell me what´s wrong on it?
i added begin = c
but stills gives me an error..
Code:
#include "stdio.h"
int main()
{
int i=0,j;
char c,str[50],*begin;
begin=str;
printf("Enter a message : ");
while( (( c = getchar() ) != '\n') && (i < 49) )
{
begin = c;
begin++;
i++;
}
begin = '\0';
printf("Reversal is : \t");
for(j=i-1;j>=0;j--)
printf("%c",str[j]);
printf("\n");
}