This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes C / C++ and the fly likes how to treat characters in a string like integers? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Languages » C / C++
Bookmark "how to treat characters in a string like integers?" Watch "how to treat characters in a string like integers?" New topic
Author

how to treat characters in a string like integers?

thejwal pavithran
Ranch Hand

Joined: Feb 11, 2012
Posts: 119
how to treat characters in a string like integers?
hey guys i have a simple function which reads in two integer arrays and outputs the number of same elements in the 2 arrays.

eg:
input:
{11,22,12,13}
{44,55,22,11}

the output will be 2 here.

my function prototype is:

void compare(int list1[],int list2[]);

but theres a glitch.

the modules which call the function pass the lists as character arrays.

So now i should rewrite the function and the prototype would be:

void compare(char* input1,char* input2);

I have absolutely no idea on how to compare two integers thus way. can Somebody please tell me how to compare two integers if the belong to a char array


on job hunt
 
Have you checked out Aspose?
 
subject: how to treat characters in a string like integers?
 
It's not a secret anymore!