Site navigation
1. Hello World |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Welcome to C23 TutorialLearn the basics of the C23 programming language. Lesson 1: Hello, World!
#include <stdio.h>
int main()
{
printf("Hello, World!\n");
return 0;
}
This program prints a message on the screen. Lesson 2: Variables
#include <stdio.h>
int main()
{
int age = 18;
double pi = 3.14159;
printf("%d\n", age);
printf("%f\n", pi);
return 0;
}
Variables store data in memory. Lesson 3: Bool
int main()
{
bool ok = true;
if (ok)
{
return 0;
}
return 1;
}
The bool type stores true or false.(in this code used C23 and above) Lesson 4: Arrays
#include <stdio.h>
int main()
{
int numbers[5] = {1, 2, 3, 4, 5};
printf("%d\n", numbers[0]);
return 0;
}
Arrays store multiple values of the same type. Lesson 5: Functions
#include <stdio.h>
int add(int a, int b)
{
return a + b;
}
int main()
{
printf("%d\n", add(2, 3));
return 0;
}
Functions allow code reuse. Lesson 6: Pointers
#include <stdio.h>
int main()
{
int value = 42;
int *ptr = &value;
printf("%d\n", *ptr);
return 0;
}
Pointers store memory addresses and can be used to access data indirectly. C23 Topics
|
C23 Tutor v1.0