Welcome to Raspberry Pi 4B repository
2.Print Hello World
Step 1:Create a file to store the project
mkdir C
Step 2:Enter this folder
cd C/
Step 3:Create and open helloworld.c file.
nano helloworld.c
Step 4: Writing code
#include<stdio.h>
int main()
{
printf("Hello World!n");
while(1)
{
}
return 0;
}
After writing, press Ctrl + X to exit this file.
The system will prompt you whether you need to save, press Y to save and exit.
Step 5: Compile this .c file.
gcc helloworld.c -o helloworld -lwiringPi
Step 6: Run this code
./helloworld
As shown below.
As can be seen from the above figure, after running the program, the Raspberry Pi command terminal will successfully printed out "Hello World!".