Hello,
I know this is a bad program and I have thrown in many bugs related to type conversion. I am getting a warning also. Can you help me correct it ?
Code:
#include<stdio.h>
#include<conio.h>
int main()
{
char ch[256];
int cha[256];
int count;
printf("Enter a sentence:");
fgets(ch,256,stdin);
printf("\n%s",ch);
for(count=0;ch[count]!='\0';count++)
{
cha[count]=((int)ch[count]+2);
}
cha[count]=0;
printf("\n After Encryption: ");
/* for(count=0;cha[count]!=0;count++)
{
printf("%c",cha[count]);
}*/
puts((char)cha); /* [Warning] cast from pointer to integer of different size */
getch();
return 0;
}
Thank you.