[Legacy Content] This page contains very old information, which might not be valid anymore, they are only kept here for legacy purposes.
if you have any inquiries, feel free to contact me! Click here
Created: Monday, 12 August 2013 Written by Ehab Eldeeb
Data Type is a reserved word for any programming language that tells the program what type of data you are using
- An identifier is the name used for a data object (a variable or a constant), or for a function, in a C program.
- Note that it's case-sensitive (Ehab is not ehab .. they are different)
- using meaningful identifiers is a good thing for yourself so you can understand what you are doing
an identifier must start with a letter or underscore .. you can't begin your identifier with a number, and be followed by zero or more letters
(A-Z, a-z), digits (0-9), or underscores
It's okay to use these examples for an identifier:
While it's NOT okay to use these words as identifiers:
%d %f %lf %c ... what are those?
Example:
int age = 8;
printf( “ The age is %d years “, age );
This will print out "The age is 8 years"
You will understand more when we get into writing an actual program
\n .. New Line
Example: printf("My name is \n Ehab");
This will print out "My Name is " on a line, and "Ehab" on the line under it
\t .. tabbed space (Just like if you press "space" 5 times)
You can write a comment inside your program using this tag /* .......... */
Example: printf("Hello World"); /* Print out hello world message */
the comment "Print out hello world message" will be seen in the source code, but will not be displayed in the actual application
#include <stdio.h>
#include <conio.h>
void main(){
printf("Hello World");
getch();
}
... That's it :D
Syntax errors : detected by complier
Run-time errors
Logical errors
.... This was the introduction to C Programming
For sure, you will understand better in the lecture, this article is just for reference