iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-15-2009, 05:09 AM
WebProWorld New Member
 
Join Date: Apr 2009
Posts: 1
Stella Richards RepRank 0
Default Can anyone solve this question in C programming Language?

Hello,

Write code to solve the following problem. Define a function that takes a String as a parameter and returns an integer value. The function need to loop through each character in the input string to find a value of “x”. If a value of “x” is found in the string then return the position within the string where “x” is found else return -1.
Reply With Quote
  #2 (permalink)  
Old 04-15-2009, 09:26 AM
DaveSawers's Avatar
WebProWorld Veteran
 
Join Date: Dec 2006
Location: Calgary, Alberta, Canada
Posts: 492
DaveSawers RepRank 3DaveSawers RepRank 3
Default Re: Can anyone solve this question in C programming Language?

I thought the point of getting assignments to do was so you could actually do some thinking and then do the work required on your own!
__________________
Dynamic Software Development
www.activeminds.ca
Reply With Quote
  #3 (permalink)  
Old 04-15-2009, 09:57 PM
deepsand's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: May 2004
Location: Philadelphia, PA
Posts: 3,267
deepsand RepRank 9deepsand RepRank 9deepsand RepRank 9deepsand RepRank 9deepsand RepRank 9deepsand RepRank 9deepsand RepRank 9deepsand RepRank 9deepsand RepRank 9deepsand RepRank 9deepsand RepRank 9
Default Re: Can anyone solve this question in C programming Language?

What I'm curious about is how the OP managed to have a Signature Link with only 1 post, when the stated rules require 10 for such!
Reply With Quote
  #4 (permalink)  
Old 04-17-2009, 10:10 AM
WebProWorld Member
 
Join Date: Apr 2009
Location: Tokyo
Posts: 26
nayes84 RepRank 0
Default Re: Can anyone solve this question in C programming Language?

I can write you the whole thing but it is better not to do so to make you think of it, I will just give you some hints.

you need to define the function to take an array of char type
ex: int func(char str[])

then loop through str array using for loop or while loop or whatever
and in the loop check on str[i] and 'x' if found just return i where i is the loop counter
then after the loop (which will be reached only if 'x' is not found just type
return -1

hope I could help
Quote:
Originally Posted by Stella Richards View Post
Hello,

Write code to solve the following problem. Define a function that takes a String as a parameter and returns an integer value. The function need to loop through each character in the input string to find a value of “x”. If a value of “x” is found in the string then return the position within the string where “x” is found else return -1.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How is a new web programming language written ? jeena1 Web Programming Discussion Forum 10 03-19-2009 08:28 PM
Favourite Programming Language? nojip Web Programming Discussion Forum 3 07-20-2008 01:28 AM
what programming language should I use for context ad application? EditFast Web Programming Discussion Forum 1 06-14-2007 09:06 AM
Programming Language Inventor or Serial Killer Mac 5 The Castle Breakroom (General: Any Topic) 1 03-25-2004 05:28 PM
I have a question about the English language janeth The Castle Breakroom (General: Any Topic) 7 11-03-2003 01:52 AM


All times are GMT -4. The time now is 02:45 PM.



Search Engine Optimization by vBSEO 3.3.0