954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

how to convert string array in integer array

like i have a string ch[100] how can i convert each character of it to integer that is ascii value which can be later converted in to binary so that ascii value of each character in a string has a corresponding binary value

pavitragupta
Newbie Poster
5 posts since Dec 2007
Reputation Points: 10
Solved Threads: 0
 

You don't need to convert because char is already an integer(8bit integer). You can directly assign it to integer.

for(i = 0; i < 100; i++)
  num[i] = ch[i];
invisal
Posting Pro
562 posts since Mar 2005
Reputation Points: 350
Solved Threads: 64
 

Like he said :)

twomers
Posting Virtuoso
1,877 posts since May 2007
Reputation Points: 453
Solved Threads: 57
 
which can be later converted in to binary so that ascii value of each character in a string has a corresponding binary value


From what I understand, you want to convert char to int. That has been answered. Then you want to convert the int to binary. Where do you want to store that binary value? In another array? Please specify.

Jishnu
Posting Pro
518 posts since Oct 2006
Reputation Points: 193
Solved Threads: 25
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You