okay.. i bought teh book "Teach Yourself C In 21 Days" today and have found it to be a good book to learn from.. so, here i am plodding along, typing the example programs and all of a sudden one seg faults when it comes to the 'if' statements while it's running... any of you know why such a simple program would seg fault?? here is the code so you can test it if you want.. (btw, i'm running it on a K7 (Athlon) 500 w/128mb RAM, console)
Code:
/* Demonstrates the use of if statements. */
#include <stdio.h>
int x, y;
int main()
{
/* input the two values to be tested */
printf("\nInput an integer value for x: ");
scanf("%d", &x);
printf("\nInput an integer value for y: ");
scanf("%d", y);
/* test values and print result */
if (x==y)
printf("x is equal to y\n");
if (x>y)
printf("x is greater than y\n");
if (x<y)
printf("x is less than y\n");
return 0;
}