This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to treat characters in a string like integers?  RSS feed

 
thejwal pavithran
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!