Posted 04 February 2015 - 04:30 PM
It's very hard to imagine all the crazy things that things really are like.
Electrons act like waves.. no they don't exactly, they act like particles.. no they don't exactly.
Words and ideas can change the world.
Posted 04 February 2015 - 11:32 PM
int=char; format should work.
Like this:
#include<stdio.h>
int main()
{
int test[25]={},i=0,j;
char a[25]="This is a test string.";
while(a[i]!='\0') {test[i]=a[i]; i++;}
for(j=0;j<i-1;j++) printf("%d ",test[j]);
return 0;
}
results in:
84 104 105 115 32 105 115 32 97 32 116 101 115 116 32 115 116 114 105 110 103
Hopes this helps.
Thank you.
If I don't reply back to you in 2 days, feel free to send me a PM.
“You’re lying… just like you were lying to me before. You have to hate me. I’ve been the worst daughter in the world… you should hate me.”
“But I don’t, Nyx. Because, Nyx, I’m your mother, and a mother will always love her daughter, no matter what.” -Past sins by Pen stroke.
Posted 05 February 2015 - 03:14 PM
Posted 06 February 2015 - 09:17 AM
Thanks for your help!
Hey Billy,
Yeah If I was to do real encryption I'd never send anything using a method of my own, I'm not the best at advanced Math! ![]()
It's a college project were we are learning C and procedural programming so it's not going to be implemented in any way.
I have considered using a rotational encryption method but I'd still have to change the character to ascii before hand right?
Kind regards,
It's very hard to imagine all the crazy things that things really are like.
Electrons act like waves.. no they don't exactly, they act like particles.. no they don't exactly.
Words and ideas can change the world.
Posted 06 February 2015 - 04:21 PM
On most platforms it will already be in ASCII. char is a integral type -- it stores a number that represents the character. Sirawit's example above just takes that and asks printf to print it as a number instead of as a character.I have considered using a rotational encryption method but I'd still have to change the character to ascii before hand right?
0 members, 1 guests, 0 anonymous users