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

20 lines
499 B
C++
Raw Normal View History

#include <printf.h>
#include <syscall.h>
2020-04-26 17:19:07 +04:00
int myarray[1000];
int main()
{
printf("I'm a C++ program, and I'm running in user space. How about a big, Hello World\n");
printf("My array is at 0x%p\n", myarray);
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;
}