Recent content by lifesamd

  1. L

    If else

    I found a way out.. That is to use getch() instead of getchar().. that works well... but can anyone tell me why the previous code that i wrote wasnt working?
  2. L

    If else

  3. L

    Difference between void main() and main()

    Best answer selected by lifesamd.
  4. L

    If else

    Hey, I was trying to make a small game like that who wants to be a millionaire thing. The code I wrote was:- printf("Question 1. The question\n\n"); printf(" a. option a\t b. option b\n c. option c\t\td. option d\n\n"); a = getchar(); if (a == 'a' || a == 'c' || a == 'd') {...
  5. L

    Suggestion for books.

    Hey, am pursuing my graduation in Information technology.. so, computer languages are gonna be my career base.. Now, I'm starting to learn C language. Will follow it by C++, then Java and eventually C#.. So, can you guys suggest me some books that would be good for learning C and java? Am...
  6. L

    Where is the mistake?

    #include<stdio.h> void main() { long n; char a; n=0; while((a = getchar()) != EOF) { if(a == '\n') ++n; } printf("the number of lines is %ld", n); } I use this source code for counting the no. of lines in an article that will be typed in. But the problem is...
  7. L

    Difference between void main() and main()

    Hey, First of all, am a noob in programming.. Am just starting to learn.. Now, I use Dennis Ritchie's book "the c programming language" as reference for learning the C language... The examples he gave for running the hello world program and many many others all start with main() and that works...