PDA

View Full Version : C Programming



nair
October 2nd, 2010, 08:05 PM
Two brief unrelated questions pertaining to C programming:

1. How do you search an array for a specific value, (ex. array of 100 integers, x = 7, search to see if x occurs as an element in the array, or how many times it occurs in the array)?

2. Say you have a user inputing data, which you want to record using the 'scanf' function--meaning the user is typing in the input. How do you set an 'if statement' condition to be based on datatype input by the user--so that the 'if statement' will only accept certain datatypes for input (ex. you want the user to only input floats, and if they input chars, the 'else statement' is run instead)?

dwhitney67
October 2nd, 2010, 08:16 PM
Posting homework questions is NOT permitted on this forum!