This document provides information about integrated development environments (IDEs) and the C programming language. It lists some common IDEs like Visual Studio, Codeblocks, Netbeans, and Xcode. It then focuses on using the DEVC++ IDE for C programming. It outlines some basics of C programming, including data types, operators, variables, and functions. It provides examples of code with errors to identify, covering topics like if/else statements, data type mismatches, and function calls.
2. What is IDE??
Examples: Visual Studio(VB.NET,C#), Codeblock(C,C++),
Netbean(JAVA), Xcode(C#,JAVA,Phyton)
In this lab: DEVC++ for C
Provides to write, editing code
Deliver into application that
A way to compile/debug the code we use
Create and Test Your project
Some IDE not only write text but maybe it has embedded
with object, Translator, or prescript code
which may help the coding is done more easier
5. Fundamental of C
Basically a a program C must have:
Main()
{
}
Reserved keyword in C must be written as included in the compiler:
User cannot change its appearance!
Example int, float, goto, else, char,void, main….
Others are printf, scanf, and more..
Variable name cannot be used as same as the reserved keyword
C variable refers to the name given to the memory location to
store data
6. Rule to name a variable:
Must start with alphabet, cant be start with number
Can be written in lower and uppercase
Cannot use reserved keyword in C
Special character not allowed only (_)
Data Type:
Data types Format
string
int %d
Unsigned int %u
Float %f
Long %ld
Unsigned long %lu
double %lf
Long double %lf
char %c /%s
Unsigned char %c/%s
8. Relational Operator
Operator operation Ex
> greater than a>b
< less than a<b
>= greater than equal to a<=b
<= less than equal to a>=b
== equal to a= =b
!= not equal to a!=b
Logical operators:
Operator operation Ex
&& AND (a>b)&&(a>c)
|| OR (a>b)||(a>c)
9. Exercise: Identifying the Error!
Purpose of the program: IF the grade is a, add 10 to the marks
#include<stdio.h>
void main()
INT mark;
char 1grade;
scan(“%d %c”, &mark, & 1grade);
if(grade = =’a’)
{
mark=mark-10;
}
printf(“%d”,mark);
}
10. Purpose of the program: To find the rectangle area
#include<stdio.h>
{
float a,b;
void area_rectangle (float, float);
clrscr();
printf(“n enter the length & breadth:”);
scanf(“%d %d”, &a, &b);
area_rectangle (a,B);
getch();
}
void area_rectangle(x,y)
float x,y;
{
float area;
area=x*y;
Printf(“n area of rectangle is %f”, area);
return;
}