C Programming COP 3223 lecture 1. Raja Iqbal. About Myself. Graduate Student at the School of EECS Areas of Interest are Image Compression, Signal Processing, Hardware and ASIC Design and FPGA Architectures Work Experience Graduate Research Assistant, School of EECS
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
C ProgrammingCOP 3223lecture 1
Raja Iqbal
On completion of this syllabus you should be able to
There are millions of books on C Programming. I will name few that I like.
#include <stdio.h>
void main(void)
{
printf(“Hello, world\n”);
}
The following will be the output of the Hello World program
Hello, world

Variable names are example of identifiers.They have the following rules:
123
a123
_fred
num people
num_employees
numstaff
Are they the same?
VALUE
Value
value
VaLuE
_Value_
Whole number types
char
short intorshort
int
long int or long
Floating point types
float
double
long double
int counter1;
long num_records = 0;
double length = 3.7, width = 2.7;
What is 5 divided by 2?
printf("There are %d people here.\n", num_people);
%d for integer
%efor float in scientific notation
%ffor float in decimals
%gchooses %e or %f format for you
%cfor ASCII character
%lefor a double in scientific notation
%.2ffor float to 2 places of decimals
\% or %%for literal % sign
\"for literal "
\nfor new line
\tfor tab
\\for literal backslash
scanf("%d %f", &my_int, & my_float);
fflush(stdin);
x + 2;
y = x + 2;
a = 5 + b = c * 2;
1. Include stdio.h and declare main
2. Declare space for variables
3. Input the value in centigrade
4. Do the calculation
5 Output the answer.
#include <stdio.h>
void main (void)
{
float cent, fahr;
printf("Enter temperature in Centigrade\n");
scanf("%f",¢);
fahr = cent * 9/5 + 32;
printf("In Fahrenheit this is %.2f degrees\n",fahr);
}
instead write a+= b;
instead write a++ or ++a
Order in which arithmetic operations are evaluated
unsigned int population;
int x;
float y;
:
:
x = (int) y;
Note that this truncates and does not round