C For Engineers & Scientists, An Interpretive Approach with Companion CD

Harry Cheng

Mentioned 1

C for Engineers and Scientists is a complete and authoritative introduction to computer programming in C, with introductions to object-oriented programming in C++, and graphical plotting and numerical computing in C/C++ interpreter Ch® and MATLAB® for applications in engineering and science. This book is designed to teach students how to solve engineering and science problems using C. It teaches beginners with no previous programming experience the underlying working principles of scientific computing and a disciplined approach for software development. All the major features of C89 and C99 are presented with numerous engineering application examples derived from production code. The book reveals the coding techniques used by the best C programmers and shows how experts solve problems in C. It is also an invaluable resource and reference book for seasoned programmers. C for Engineers and Scientists focuses on systematic software design approach in C for applications in engineering and science following the C99, the latest standard developed by the ANSI and ISO C Standard Committees which resolved many deficiencies of C89 for applications in engineering and science. The book includes a companion CD which contains the C/C++ interpreter Ch for use as an instructional tool as well as Visual C++ and gcc/g++ compilers to help teaching and learning of C and C++. Ch presents a pedagogically effective user-friendly interactive computing environment for the simplest possible teaching/learning computer programming in C so that the students can focus on improving their program design and problem solving skills.

More on Amazon.com

Mentioned in questions and answers.

I'm working on the following homework problem from C for Scientists and Engineers:

Given the following declarations and assignments, what do these expressions evaluate to?

int a1[10] = {9,8,7,6,5,4,3,2,1}
int *p1, *p2;
p1 = a1+3;
Line 14: p2 = *a1[2];

I'm trying to compile this code with gcc, but when I do so, it gives me the following error:

w03_3_prob15.c: In function 'main':
w03_3_prob15.c:14:7: error: invalid type argument of unary '*' (have 'int')

I'm using the following command to compile:

gcc -o w03_3_prob15 w03_3_prob15.c -std=c99

I'm really not sure what to do. Do you have any ideas on how to fix this error?

The line doesn't compile because it's incorrect in the book. From the author's Errata page:

Page 438, line 17 from the bottom.
p2 = *a1[2]; 
should be  p2 = &a1[2];
Realated tags

cgccpointers