#Hello World in C
1 messages ยท Page 1 of 1 (latest)
Did you watch the introduction video about Hello world?
What did you try? What do the tests show?
Please don't use screenshots/images to share text. Pixels make it hard to copy/paste text. Or even to read for many people!
I notice that it starts off returning "Goodbye, Mars!" which is pretty funny. It's kind of like the opposite of what we want to ultimately say. What do the tests say about that?
Yes, but basically he's just telling me to change a string... It's all new to me.
// Include the test framework.
#include "test-framework/unity.h"
// Include the header file with the declarations of the functions you create.
#include "hello_world.h"
// Runs before every test.
void setUp(void)
{
}
// Runs after every test.
void tearDown(void)
{
}
// Defines a single test.
static void test_say_hi(void)
{
// Check if the 'hello()' function returns "Hello, World!"
// This test is expected to fail after first downloading this exercise.
// To make this test pass, fix the 'hello()' function definition in the
// source file hello_world.c.
TEST_ASSERT_EQUAL_STRING("Hello, World!", hello());
}
// Runs the test(s)
int main(void)
{
UNITY_BEGIN();
RUN_TEST(test_say_hi);
return UNITY_END();
}
Yeah, that's all you need to do for this first one. It is like a first soft check
Do you know how to change the string?
๐๐ผ Hello! We are happy to have you here. Exercism is best suited for people who have some experience in programming. If you are completely new to the topic, exercism might be very challenging. There are many great resources online, that can kickstart your journey in computer science. For a wide understanding, you can try the free CS50x course at Harvard: http://cs50.harvard.edu/x/2024/. If you want to focus on web development you can also try The Odin Projects (free and open source: http://theodinproject.com). It is a long-term commitment, that will guide you to master some projects and will prepare you to show off a nice portfolio in the end. Another interesting resource for web development are the MDN web docs: http://developer.mozilla.org/en-US/docs/Learn
Nope ๐ฅฒ
You may want to start with one of the beginner resources.
That's right, I just restarted the exercise and it worked, like WTF?
#include "hello_world.h"
// Define the function itself.
const char *hello(void)
{
return "Hello, World!";
}
It's a pretty simple exercise. It's meant to introduce you to the site. Not to be hard.