Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
Alright, so first things first: Why am I deciding to learn C? Well, I mostly contribute that decision to Mateo, but at the same time, my interest in C would have never occured if KryptonicDragon hadn't sent me a link to Beej's guide for learning C. I find all of the function calls and pointers comparatively similar to that of math (function calls are sort of like composite functions I learned in PreCalc). If that doesn't really make sense, what's important is that it makes sense to me and through that connection, I can make a *decent* C program. So far, I have not downloaded a compiler yet (just been using the online compiler at http://learn-c.org), so I was wondering if there was a specific compiler that works best or is favored. Also obviously, I can't just send my raw C program to my calculator and I also have noticed that there are various different #include files that I didn't learn in Beej's Guide (including those C Libs I constantly hear about). I was wondering if there was a directory (somewhere on Github, I assume) containing those commands and how to use them. Also how do I get my "raw" C program formatted to a .8xp file for the calculator?

I know that Mateo sent me a link on SAX on something similar to this topic, but I forgot to grab the link before it disappeared.
Check out the toolchain:
https://github.com/CE-Programming/toolchain/releases/latest

And the toolchain wiki, where you can find the C libraries documentation:
https://github.com/CE-Programming/toolchain/wiki

Then once you have the toolchain installed, start looking through the examples provided and seeing how they work.
Thanks, Mateo!

I still thinks its whack how in "standard C" (ANSI C?), the "Hello World" program looks would like this (hopefully):


Code:
#include <stdio.h>
int main(void){
printf("Hello, World!\n");
printf("Welcome to C!\n");
return 0;
}


...And then the same exact thing for the CE Very Happy :

Code:
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <tice.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void printText(const char *text, uint8_t x, uint8_t y);
void main(void) { 
    const char *HelloWorld = "Hello World!";
    const char *Welcome = "Welcome to C!";
    os_ClrHome();
    printText(HelloWorld, 0, 0);
    printText(Welcome, 0, 1);
    while (!os_GetCSC());
}
void printText(const char *text, uint8_t xpos, uint8_t ypos) {
    os_SetCursorPos(ypos, xpos);
    os_PutStrFull(text);
}
I don't get why that example is so complicated - all you really need is this:

Code:

#include <tice.h>
void main(void) {
    os_ClrHome();
    os_SetCursorPos(0,0);
    os_PutStrFull("Hello, World!");
}


The os_ClrHome and os_SetCursorPos functions are only necessary to avoid writing to a partially filled screen. The while (!os_GetCSC()); bit is there to stop the program from exiting right away, and the bunch of includes at the beginning is just a good practice to avoid errors from using a function without including its header. IMO the rest of the example gives a good overview of the basics of C, but it's inappropriate for a hello world program, which is supposed to be as simple as possible.
I created a GitHub repository here for Spherix. Check it out for the source code. Good Idea

*Note: Probably should start a different forum for Spherix C(?) because the other forum on Spherix was in ICE.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement