C Primer Plus (5th Edition)

Category: Programming
Author: Stephen Prata
4.0
All Stack Overflow 7
This Year Stack Overflow 1
This Month Stack Overflow 1

Comments

by orionblastar   2020-09-06
I learned from Sam's C Primer Plus.

https://www.amazon.com/Primer-Plus-5th-Stephen-Prata/dp/0672...

My version was older than the Amazon version as I learned in 1987.

by anonymous   2017-08-20

You declared the array wrong, correct way:

int a[7]={1,2,3,4,5,6,7};

Also you cannot declare two as rename the second:

int a=len/2; 

to something else.

Might I suggest some good C Books? I think you need to learn C before coding in it.

by AviewAnew   2017-08-20

Reference Style - All Levels

Beginner

Intermediate

Above Intermediate

Uncategorized Additional C Programming Books

  • Essential C (Free PDF) - Nick Parlante
  • The new C standard - an annotated reference (Free PDF) - Derek M. Jones
by anonymous   2017-08-20

This is a common mistake amongst newer C/C++ developers. The scanf function detects you hitting the ENTER/RETURN key to signal the end of input, but it also catches the \n character as well at the end of the input string, so you essentially get two RETURNS being detected.

Please read up on an example of using fgets and sscanf here:

http://www.linuxforums.org/forum/programming-scripting/67560-problem-scanf.html


It will resolve this issue very quickly for you. In the meantime, I strongly urge you to check out this book:

http://www.amazon.com/Primer-Plus-5th-Stephen-Prata/dp/0672326965


It is the most commonly used C programming book in high school and colleges in North America, and has TONS of examples for you to work through, including this specific program you demonstrated above. The print version has more examples than the e-book, so I would just cough up the $30.00 for the printed version.

Good luck!