I am new and need some help

0 Anis S · November 2, 2014
need your help to figure my mistake in this c program

#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    
    
    int age;
    int currentYear;
    int birthYear;
    
    currentYear = 2014;
    age = currentYear - birthYear;
    printf("Please enter your Birth year\n");
    scanf(" %d\n"), birthYear;
    printf("you are %d Years old\n", age);
    
    
    
    return 0;
}

Post a Reply

Replies

Oldest  Newest  Rating
0 Berith Baal · November 2, 2014
#include <stdio.h>

int main(int argc, const char * argv[]) {
// insert code here...


int age;
int currentYear;
int birthYear; --> ???

currentYear = 2014;
age = currentYear - birthYear;
printf("Please enter your Birth year\n");
scanf(" %d\n"), birthYear;
printf("you are %d Years old\n", age);



return 0;



#include <stdio.h>

int main ( int argc, char* argv[] ) {
  int age;
  int currentYear;
  int birthYear = 1980;
  currentYear = 2014;
  age = currentYear - birthYear;
  printf("Please enter your birthday: ");
  scanf("%d", &birthYear);
  printf("You are %d Years old\n", age);
  return 0;
}
0 Anis S · November 2, 2014
thanks man
0 Daniel Vladimirov · November 2, 2014
Can somebody explain me the function of the & in the scanf function?
0 Berith Baal · November 2, 2014
Well, C programming language is a low-level programming language, and any input/output action is directly using the computer memory.

I suggest to read this book:
http://www.informit.com/store/c-programming-language-9780133086225
+2 Kevin Barbuto · November 2, 2014
It's like an array, except not.
0 Youknees Adoro · November 3, 2014
c is a high level programming language
0 Berith Baal · November 4, 2014
In the generation terms YES IT IS A HIGH LEVEL. But in usage you must use memory with functions that allowing it to use them.
  • 1

C

106,984 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator