Introduction To C Programming
Introduction To C Programming
Introduction to C Programming
• Agenda for Section 1:
2
Introduction to Programming and C Language
• What is Programming?
• History of C Language
4
Basic Structure of a C Program
• The Structure of a C Program
• Preprocessor directives (#include <stdio.h>).
• Main function: int main().
• Output using printf().
• Example: "Hello World" Program.
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
} 5
Basic Structure of a C Program
• Key Components of a C Program
• Compilation Steps
• Preprocessing.
• Compilation.
• Assembly.
• Linking to generate an executable file. 6
Basic Structure of a C Program
• Comments in C
• Types of Comments
• Single-line comments: // Comment.
• Multi-line comments: /* Comment */.
• Used for code documentation and clarity
7
Data Types and Variables in C
• Data Types in C
9
Input and Output Functions in C
• Input/Output in C
10
Input and Output Functions in C
• Example Program: Input/Output
#include <stdio.h>
int main() {
int a;
printf("Enter a number: ");
scanf("%d", &a);
printf("You entered: %d", a);
return 0;
}
11
Summary and Key Takeaways
• Summary of Section 1
12
Summary and Key Takeaways
• Key Takeaways
13
Thank You!