1
0
mirror of https://github.com/sgmarz/osblog.git synced 2024-11-24 02:16:19 +04:00
osblog/risc_v/src/userspace/helloworld.cpp

18 lines
456 B
C++
Raw Normal View History

#include <printf.h>
#include <syscall.h>
int main()
{
2020-04-26 05:35:32 +04:00
int myarray[1000];
printf("I'm a C++ program, and I'm running in user space. How about a big, Hello World\n");
2020-04-26 05:35:32 +04:00
printf("I'm going to start crunching some numbers, so gimme a minute.\n");
for (int i = 0;i < 1000;i++) {
myarray[i] = 0;
}
for (int i = 0;i < 100000000;i++) {
myarray[i % 1000] += 1;
}
printf("Ok, I'm done crunching. Wanna see myarray[0]? It's %d\n", myarray[0]);
return 0;
}