Hi Everyone,
First off, I'm new to the board, so hello. Second, I'm new to programming in C, so this might seem like a basic question.
As I'm reading/learning the language, I'm trying to create a basic program that functions very well. I this case I'm trying to make a tip calculator.
I've gotten the main bits to work, but I'm wondering how I can compare a variable to its own data type.
For instance, everything I'm reading about logical operators uses values as an example:
int main ()
#include <stdio.h>
#include <stdlib.h>
int main() {
int newInt
newInt = 3
if (newInt == 3) {
printf ( "etc etc etc...");
}
I want to compare the variable to evaluate whether or not it is a the correct data type.
For instance, I'd like to code things so that if the bill amount the user enters is not a number, they get an error.
Is there an equivelent to if (newInt != int);
Please help! I remember being able to do this in Pascal, which was the language I learned many, many years ago. How do I do it in C?
Thanks to everyone for taking a look at my problem!



LinkBack URL
About LinkBacks



